From 71b3112b35f12f9484ce74fd792f4b6f7e8078be Mon Sep 17 00:00:00 2001 From: Moritz Huebner <email@moritz-huebner.de> Date: Tue, 5 Jun 2018 13:54:19 +1000 Subject: [PATCH] Added some tests --- test/prior_tests.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/prior_tests.py b/test/prior_tests.py index bca3df485..b6d8ad2fe 100644 --- a/test/prior_tests.py +++ b/test/prior_tests.py @@ -24,6 +24,18 @@ class TestPriorInstantiationWithoutOptionalPriors(unittest.TestCase): def test_class_instance(self): self.assertIsInstance(self.prior, tupak.prior.Prior) + def test_magic_call_is_the_same_as_sampling(self): + self.prior = Mock(return_value=0.5) + self.assertEqual(self.prior.sample(), self.p()) + + def test_base_rescale_method(self): + self.assertIsNone(self.prior.rescale()) + + def test_base_repr(self): + self.prior = tupak.prior.Prior(name='test_name', latex_label='test_label', minimum=0, maximum=1) + expected_string = "Prior(name='test_name', latex_label='test_label', minimum=0, maximum=1)" + self.assertEqual(expected_string, self.prior.__repr__()) + class TestPriorName(unittest.TestCase): -- GitLab