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_eav_convert(self):
     array_example = np.array([(0, 1), (4, 5)],
                              dtype=[('x', int), ('y', float)])
     expected_output = [(0, 'x', 0), (0, 'y', 1), (1, 'x', 4), (1, 'y', 5)]
     real_output = EavConverter.convert_to_eav(array_example)
     self.assertEqual(
         expected_output,
         real_output,
         msg="wrong conversion from array to eav, tables are not equal")
 def test_wrong_array_format_exception(self):
     with self.assertRaises(TypeError, msg="don't raise wrong format exception"):
         array_example = np.array([[0, 1], [4, 5]])
         EavConverter.convert_to_eav(array_example)
 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_eav_convert(self):
     array_example = np.array([(0, 1), (4, 5)], dtype=[('x', int), ('y', float)])
     expected_output = [(0, 'x', 0), (0, 'y', 1), (1, 'x', 4), (1, 'y', 5)]
     real_output = EavConverter.convert_to_eav(array_example)
     self.assertEqual(expected_output, real_output,
                      msg="wrong conversion from array to eav, tables are not equal")
Beispiel #6
0
 def test_wrong_array_format_exception(self):
     with self.assertRaises(TypeError,
                            msg="don't raise wrong format exception"):
         array_example = np.array([[0, 1], [4, 5]])
         EavConverter.convert_to_eav(array_example)