Esempio n. 1
0
 def test_config_ok(self):
     errors = check_config(self.input_file,
                           translate_separator(self.separator),
                           self.columns_to_show, self.help_column,
                           self.output_file, self.class_column,
                           self.classes)
     self.assertTrue(len(errors) == 0)
Esempio n. 2
0
 def test_control_file_saved(self):
     output_file = 'data/output_test.csv'
     self.df.to_csv('data/output_test_partial.csv', sep=';', encoding='utf-8')
     errors = check_config(self.input_file, translate_separator(self.separator), self.columns_to_show,
                           self.default_column, output_file, self.class_column, self.classes)
     self.assertTrue('Looks like there is a control file saved and'
                     ' class column specified is not an existing column in it.' in errors)
Esempio n. 3
0
 def test_output_path_no_exists(self):
     output_file = 'data/output_test.csv'
     errors = check_config(self.input_file,
                           translate_separator(self.separator),
                           self.columns_to_show, self.help_column,
                           output_file, self.class_column, self.classes)
     self.assertTrue('Output path does not exist' in errors)
Esempio n. 4
0
 def test_no_output_file(self):
     output_file = ''
     errors = check_config(self.input_file,
                           translate_separator(self.separator),
                           self.columns_to_show, self.help_column,
                           output_file, self.class_column, self.classes)
     self.assertTrue('You must to specify an output file' in errors)
Esempio n. 5
0
 def test_no_columns_to_show(self):
     columns_to_show = []
     errors = check_config(self.input_file,
                           translate_separator(self.separator),
                           columns_to_show, self.help_column,
                           self.output_file, self.class_column,
                           self.classes)
     self.assertTrue('Columns to show not specified.' in errors)
Esempio n. 6
0
 def test_no_classes(self):
     help_column = ''
     classes = []
     errors = check_config(self.input_file,
                           translate_separator(self.separator),
                           self.columns_to_show, help_column,
                           self.output_file, self.class_column, classes)
     self.assertTrue('There are not defined classes.' in errors)
Esempio n. 7
0
 def test_class_column_in_columns(self):
     class_column = 'col2'
     errors = check_config(self.input_file,
                           translate_separator(self.separator),
                           self.columns_to_show, self.help_column,
                           self.output_file, class_column, self.classes)
     self.assertTrue(
         'Column col2 already exists in the CSV file.' in errors)
Esempio n. 8
0
 def test_no_help_column(self):
     help_column = 'col3'
     errors = check_config(self.input_file,
                           translate_separator(self.separator),
                           self.columns_to_show, help_column,
                           self.output_file, self.class_column,
                           self.classes)
     self.assertTrue(
         'Help column does not exist in the CSV file.' in errors)
Esempio n. 9
0
 def test_output_file_exists(self):
     output_file = 'output_test.csv'
     self.df.to_csv('output_test.csv', sep=';', encoding='utf-8')
     errors = check_config(self.input_file,
                           translate_separator(self.separator),
                           self.columns_to_show, self.help_column,
                           output_file, self.class_column, self.classes)
     self.assertTrue(
         'Looks like exists a finished output file. Drop it if you want to start again.'
         in errors)
Esempio n. 10
0
 def test_column_to_show_no_exist(self):
     columns_to_show = [
         'col3',
     ]
     errors = check_config(self.input_file,
                           translate_separator(self.separator),
                           columns_to_show, self.help_column,
                           self.output_file, self.class_column,
                           self.classes)
     self.assertTrue(
         'col3 column does not exist in the CSV file.' in errors)
Esempio n. 11
0
 def test_no_class_column(self):
     class_column = ''
     errors = check_config(self.input_file, translate_separator(self.separator), self.columns_to_show,
                           self.default_column, self.output_file, class_column, self.classes)
     self.assertTrue('You must to specify a class column' in errors)
Esempio n. 12
0
 def test_no_separator(self):
     separator = ''
     errors = check_config(self.input_file, separator, self.columns_to_show,
                           self.default_column, self.output_file, self.class_column, self.classes)
     self.assertTrue('Separator not specified.' in errors)
Esempio n. 13
0
 def test_no_input_file(self):
     input_file = 'data/inputt_test.csv'
     errors = check_config(input_file, self.separator, self.columns_to_show,
                           self.default_column, self.output_file, self.class_column, self.classes)
     self.assertTrue('Input file doesn\'t exist.' in errors)
Esempio n. 14
0
 def test_input_output_not_same(self):
     output_file = 'data/output_test.csv'
     errors = check_config(self.input_file, translate_separator(self.separator), self.columns_to_show,
                           self.default_column, output_file, self.class_column, self.classes)
     self.assertFalse('Input and output must be different files' in errors)