Exemplo n.º 1
0
    def test_to_dict(self):
        kern = self.se_0
        cov = Covariance(kern)
        actual = cov.to_dict()

        self.assertIsInstance(actual, dict)
        self.assertIn('kernel', actual)
        self.assertEqual(kern.to_dict(), actual['kernel'])
Exemplo n.º 2
0
    def test_from_dict(self):
        test_cases = (Covariance, Serializable)
        for cls in test_cases:
            with self.subTest(name=cls.__name__):
                kern = self.se_0
                cov = Covariance(kern)
                actual = cls.from_dict(cov.to_dict())

                self.assertIsInstance(actual, Covariance)
                self.assertEqual(cov.infix, actual.infix)