Esempio 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)
Esempio 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)
 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)
Esempio 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)
Esempio 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)
 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)
Esempio 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)
 def test_unknown_input_file_should_raise_ValueError(self):
     with self.assertRaises(ValueError):
         get_data_type(self.unknown_file)
 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)
 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)
 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)