Exemplo n.º 1
0
 def test_writers_returns_list_writer_for_json(self):
     """List writer is required as this handles multiple blocks of json"""
     testing_file = "./tests/json_testing_sample.json"
     file_type = get_data_type(testing_file)
     self.assertEqual(writers[file_type], list_writer)
Exemplo n.º 2
0
 def test_writers_returns_text_writer_for_text(self):
     testing_file = "./tests/ingest_testing_sample.txt"
     file_type = get_data_type(testing_file)
     self.assertEqual(writers[file_type], text_writer)
Exemplo n.º 3
0
 def test_flattener_returns_already_flat_flattener_for_text(self):
     testing_file = "./tests/ingest_testing_sample.txt"
     file_type = get_data_type(testing_file)
     self.assertEqual(flatteners[file_type], already_flat)
Exemplo n.º 4
0
 def test_processor_returns_json_processor_for_json(self):
     testing_file = "./tests/json_testing_sample.json"
     file_type = get_data_type(testing_file)
     self.assertEqual(processors[file_type], json_process)
Exemplo n.º 5
0
 def test_cleaner_returns_text_cleaner_for_text_file(self):
     testing_file = "./tests/ingest_testing_sample.txt"
     file_type = get_data_type(testing_file)
     self.assertEqual(cleaners[file_type], TextCleaner.text_clean)
Exemplo n.º 6
0
 def test_flattener_returns_dict_flattener_for_json(self):
     testing_file = "./tests/json_testing_sample.json"
     file_type = get_data_type(testing_file)
     self.assertEqual(flatteners[file_type], flatten_dict)
Exemplo n.º 7
0
 def test_cleaner_returns_json_cleaner_for_json_file(self):
     testing_file = "./tests/json_testing_sample.json"
     file_type = get_data_type(testing_file)
     self.assertEqual(cleaners[file_type], JSONCleaner.clean_single_quotes)
Exemplo n.º 8
0
 def test_unknown_input_file_should_raise_ValueError(self):
     with self.assertRaises(ValueError):
         get_data_type(self.unknown_file)
Exemplo n.º 9
0
 def test_text_input_file_should_return_text_datatype(self):
     file_type = get_data_type(self.text_input_url)
     self.assertEqual(file_type, DataType.TEXT)
Exemplo n.º 10
0
 def test_xml_input_file_should_return_xml_datatype(self):
     file_type = get_data_type(self.xml_local_file)
     self.assertEqual(file_type, DataType.XML)
Exemplo n.º 11
0
 def test_json_input_file_should_return_json_datatype(self):
     file_type = get_data_type(self.json_local_file)
     self.assertEqual(file_type, DataType.JSON)