Skip to content

Commit

Permalink
Merge pull request #4 from sjayellis/main
Browse files Browse the repository at this point in the history
Adding 2 example tests for the pytest lesson.
  • Loading branch information
orbeckst authored Jun 19, 2024
2 parents f809263 + 0454815 commit fee5413
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions mdgeom/tests/test_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,33 @@ def test_extract_ugmx():
assert udata[key] == pytest.approx(reference[key])


def test_extract_ucharmm():
reference = {
"n_atoms": 3341,
"Lx": 0,
"Ly": 0,
"Lz": 0,
"alpha": 0,
"beta": 0,
"gamma": 0,
"n_frames": 98,
"totaltime": 96.9999914562418,
"dt": 0.9999999119200186,
}
universe = mda.Universe(data.PSF, data.DCD)

udata = info.extract(universe)

for key in reference:
assert udata[key] == pytest.approx(reference[key])


### Testing expected failure.
def test_extract_non_universe():
universe = "This is not a universe."
with pytest.raises(AttributeError):
udata = info.extract(universe)

### testing with fixtures


Expand Down

0 comments on commit fee5413

Please sign in to comment.