Becksteinlab / imdclient

Streaming analysis from running MD simulations.
https://imdclient.readthedocs.io/
Other
5 stars 0 forks source link

Testing: Things an IMDReader can't do #5

Open ljwoods2 opened 3 months ago

ljwoods2 commented 3 months ago

For all skipped tests in imdclient/tests/test_imdreader.py::TestIMDReaderBaseAPI, there should be a corresponding test which ensures an error is raised if the associated reader API call is made. These should be either individual methods or a part of a separate test class (not inside of TestIMDReaderBaseAPI)

For example, this method is skipped in TestIMDReaderBaseAPI. Since a rewind can't be done on a stream, there should be another method ("test_rewindraises" or similar) that ensures the reader will fail out with an appropriate message if the user attempts to call trajectory.rewind().

    @pytest.mark.skip(reason="Cannot rewind stream")
    def test_transformation_rewind(self, ref, transformed):
        # this test checks if the transformations are applied after rewinding the
        # trajectory
        v1 = np.float32((1, 1, 1))
        v2 = np.float32((0, 0, 0.33))
        ideal_coords = ref.iter_ts(0).positions + v1 + v2
        transformed.rewind()
        assert_array_almost_equal(
            transformed[0].positions, ideal_coords, decimal=ref.prec
        )
ljwoods2 commented 2 months ago

IMDReader fail on nonsense slice and incompatible API methods