def test_infer(self): input_integer = '233692469' output_i = infer(input_integer) self.assertEqual(output_i, "integer") self.assertIsNot(output_i, "string") self.assertIsNot(output_i, "number") self.assertIsNot(output_i, None) input_string = 'test' output_s = infer(input_string) self.assertEqual(output_s, "string") self.assertIsNot(output_s, "integer") self.assertIsNot(output_s, "number") self.assertIsNot(output_s, None) input_empty = '' output_e = infer(input_empty) self.assertEqual(output_e, None) self.assertIsNot(output_e, "integer") self.assertIsNot(output_e, "number") self.assertIsNot(output_e, "string")
def test_infer_datum_equals_to_none(self): res = conversion.infer(None, None, []) self.assertEqual(res, None)
def test_infer_datum_equals_to_list_datetime(self): res = conversion.infer("created_at", ["20-05-2021"], ["created_at"]) self.assertEqual(res, "list.date-time")
def test_infer_datum_equals_to_list_string(self): res = conversion.infer(None, ["test", "test1"], []) self.assertEqual(res, "list.string")
def test_infer_datum_equals_to_list_number(self): res = conversion.infer(None, [5.9, 6.9], []) self.assertEqual(res, "list.number")
def test_infer_datum_equals_to_list_list(self): res = conversion.infer(None, [[5, 6], 6], []) self.assertEqual(res, "list.string")
def test_infer_datum_equals_to_list_integer(self): res = conversion.infer(None, [5, 6], []) self.assertEqual(res, "list.integer")
def test_infer_datum_equals_to_dict(self): res = conversion.infer(None, {'test': 'test'}, []) self.assertEqual(res, "dict")
def test_infer_datum_equals_to_string(self): res = conversion.infer(None, "test", []) self.assertEqual(res, "string")
def test_infer_datum_equals_to_number(self): res = conversion.infer(None, 4.5, []) self.assertEqual(res, "number")
def test_infer_datum_equals_to_integer(self): res = conversion.infer(None, 5, []) self.assertEqual(res, "integer")