예제 #1
0
class TestLikelihoodBase(unittest.TestCase):
    def setUp(self):
        self.likelihood = Likelihood()

    def tearDown(self):
        del self.likelihood

    def test_repr(self):
        self.likelihood = Likelihood(parameters=["a", "b"])
        expected = "Likelihood(parameters=['a', 'b'])"
        self.assertEqual(expected, repr(self.likelihood))

    def test_base_log_likelihood(self):
        self.assertTrue(np.isnan(self.likelihood.log_likelihood()))

    def test_base_noise_log_likelihood(self):
        self.assertTrue(np.isnan(self.likelihood.noise_log_likelihood()))

    def test_base_log_likelihood_ratio(self):
        self.assertTrue(np.isnan(self.likelihood.log_likelihood_ratio()))

    def test_meta_data_unset(self):
        self.assertEqual(self.likelihood.meta_data, None)

    def test_meta_data_set_fail(self):
        with self.assertRaises(ValueError):
            self.likelihood.meta_data = 10

    def test_meta_data(self):
        meta_data = dict(x=1, y=2)
        self.likelihood.meta_data = meta_data
        self.assertEqual(self.likelihood.meta_data, meta_data)
예제 #2
0
class TestLikelihoodBase(unittest.TestCase):
    def setUp(self):
        self.likelihood = Likelihood()

    def tearDown(self):
        del self.likelihood

    def test_repr(self):
        self.likelihood = Likelihood(parameters=['a', 'b'])
        expected = 'Likelihood(parameters=[\'a\', \'b\'])'
        self.assertEqual(expected, repr(self.likelihood))

    def test_base_log_likelihood(self):
        self.assertTrue(np.isnan(self.likelihood.log_likelihood()))

    def test_base_noise_log_likelihood(self):
        self.assertTrue(np.isnan(self.likelihood.noise_log_likelihood()))

    def test_base_log_likelihood_ratio(self):
        self.assertTrue(np.isnan(self.likelihood.log_likelihood_ratio()))