Esempio n. 1
0
 def test_empty_file_path(self):
     with self.assertRaises(SystemExit) as cm:
         file_reading(file_path='')
     self.assertEqual(cm.exception.code, 1)
Esempio n. 2
0
 def test_wrong_file_path(self):
     with self.assertRaises(SystemExit) as cm:
         file_reading(
             file_path='/Users/Transpose/txt_files/empty_word_list1.txt')
     self.assertEqual(cm.exception.code, 1)
Esempio n. 3
0
 def test_wrong_file_format(self):
     path = join(self.project_root, 'test_word_list.doc')
     with self.assertRaises(SystemExit) as cm:
         file_reading(file_path=path)
     self.assertEqual(cm.exception.code, 1)
Esempio n. 4
0
 def test_correct_type_returned(self):
     actual_data = file_reading(file_path=self.path)
     self.assertTrue(isinstance(actual_data, list))
Esempio n. 5
0
 def test_no_empty_elements_in_list(self):
     actual_data = file_reading(file_path=self.path)
     for item in actual_data:
         self.assertTrue(len(item) > 0)
Esempio n. 6
0
 def test_file_reads_correctly(self):
     actual_data = file_reading(file_path=self.path)
     self.assertEqual(self.data, actual_data)