Exemple #1
0
    def test_deserialisation_of_wrong_class_fails(self):
        """
        Given a file where a model object has been serialised, assert that
        deserialisation of that file into a trajectory object fails with ValueError
        :return:
        """

        __, tmp_file = mkstemp()
        try:
            MODEL_P53.to_file(tmp_file)
            self.assertRaises(ValueError, Trajectory.from_file, tmp_file)
        finally:
            os.unlink(tmp_file)
Exemple #2
0
    def test_deserialisation_of_wrong_class_fails(self):
        """
        Given a file where a model object has been serialised, assert that
        deserialisation of that file into a trajectory object fails with ValueError
        :return:
        """

        s = StringIO()
        try:
            MODEL_P53.to_file(s)
            self.assertRaises(ValueError, Trajectory.from_file, s)
        finally:
            s.close()