From 0454815d0caea7d1cbc63dadd47c09f811e52067 Mon Sep 17 00:00:00 2001 From: test Date: Wed, 19 Jun 2024 09:43:30 -0400 Subject: [PATCH] Adding 2 example tests for the pytest lesson. --- mdgeom/tests/test_info.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/mdgeom/tests/test_info.py b/mdgeom/tests/test_info.py index 0b68e26..3f091c6 100644 --- a/mdgeom/tests/test_info.py +++ b/mdgeom/tests/test_info.py @@ -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