Skip to content

Commit fee5413

Browse files
authored
Merge pull request #4 from sjayellis/main
Adding 2 example tests for the pytest lesson.
2 parents f809263 + 0454815 commit fee5413

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

mdgeom/tests/test_info.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,33 @@ def test_extract_ugmx():
4141
assert udata[key] == pytest.approx(reference[key])
4242

4343

44+
def test_extract_ucharmm():
45+
reference = {
46+
"n_atoms": 3341,
47+
"Lx": 0,
48+
"Ly": 0,
49+
"Lz": 0,
50+
"alpha": 0,
51+
"beta": 0,
52+
"gamma": 0,
53+
"n_frames": 98,
54+
"totaltime": 96.9999914562418,
55+
"dt": 0.9999999119200186,
56+
}
57+
universe = mda.Universe(data.PSF, data.DCD)
58+
59+
udata = info.extract(universe)
60+
61+
for key in reference:
62+
assert udata[key] == pytest.approx(reference[key])
63+
64+
65+
### Testing expected failure.
66+
def test_extract_non_universe():
67+
universe = "This is not a universe."
68+
with pytest.raises(AttributeError):
69+
udata = info.extract(universe)
70+
4471
### testing with fixtures
4572

4673

0 commit comments

Comments
 (0)