Beispiel #1
0
 def test_conversion_involution(self):
     eav_example = [(0, 'x', 0), (0, 'y', 1), (1, 'x', 4), (1, 'y', 5)]
     real_output = EavConverter.convert_to_eav(
         EavConverter.convert_to_array(eav_example))
     self.assertEqual(eav_example,
                      real_output,
                      msg="error: conversions must be involution")
Beispiel #2
0
 def test_to_array_convert(self):
     eav_example = [(0, 'x', 0), (0, 'y', 1), (1, 'x', 4), (1, 'y', 5)]
     expected_output = np.array([(0, 1), (4, 5)],
                                dtype=[('x', float), ('y', float)])
     real_output = EavConverter.convert_to_array(eav_example)
     self.assertTrue(
         np.array_equal(expected_output, real_output),
         msg="wrong conversion from eav to array, tables are not equal")
 def test_empty_conversion(self):
     eav_example = []
     expected_output = np.array([])
     real_output = EavConverter.convert_to_array(eav_example)
     self.assertTrue(np.array_equal(expected_output, real_output),
                     msg="wrong conversion from empty eav")
 def test_conversion_involution(self):
     eav_example = [(0, 'x', 0), (0, 'y', 1), (1, 'x', 4), (1, 'y', 5)]
     real_output = EavConverter.convert_to_eav(EavConverter.convert_to_array(eav_example))
     self.assertEqual(eav_example, real_output,
                      msg="error: conversions must be involution")
 def test_to_array_convert(self):
     eav_example = [(0, 'x', 0), (0, 'y', 1), (1, 'x', 4), (1, 'y', 5)]
     expected_output = np.array([(0, 1), (4, 5)], dtype=[('x', float), ('y', float)])
     real_output = EavConverter.convert_to_array(eav_example)
     self.assertTrue(np.array_equal(expected_output, real_output),
                     msg="wrong conversion from eav to array, tables are not equal")
Beispiel #6
0
 def test_empty_conversion(self):
     eav_example = []
     expected_output = np.array([])
     real_output = EavConverter.convert_to_array(eav_example)
     self.assertTrue(np.array_equal(expected_output, real_output),
                     msg="wrong conversion from empty eav")