Esempio n. 1
0
 def test_get_statement_type_returns_unknown_statement_on_empty_keyword_in_desc(
         self):
     fv = FileValidator()
     result = fv.get_statement_type(['', '', ''])
     self.assertEqual(2, len(result))
     self.assertEqual('unknown_statement', result[0])
     self.assertEqual('unknown statement', result[1])
Esempio n. 2
0
 def test_get_statement_type_returns_cash_flow_statement_on_operations_keyword_in_desc(
         self):
     fv = FileValidator()
     result = fv.get_statement_type(['', 'Operations', ''])
     self.assertEqual(2, len(result))
     self.assertEqual('cash_flow_statement', result[0])
     self.assertEqual('cash flow statement', result[1])
Esempio n. 3
0
 def test_get_statement_type_returns_income_statement_on_revenue_keyword_in_desc(
         self):
     fv = FileValidator()
     result = fv.get_statement_type(['', 'revenue', ''])
     self.assertEqual(2, len(result))
     self.assertEqual('income_statement', result[0])
     self.assertEqual('income statement', result[1])
Esempio n. 4
0
 def test_get_statement_type_returns_balance_sheet_on_current_assets_in_desc(
         self):
     fv = FileValidator()
     result = fv.get_statement_type(['', 'current assets', ''])
     self.assertEqual(2, len(result))
     self.assertEqual('balance_sheet', result[0])
     self.assertEqual('balance sheet', result[1])
Esempio n. 5
0
 def test_get_statement_type_raises_attribute_error_on_None_keyword_in_desc(
         self):
     fv = FileValidator()
     self.assertRaises(AttributeError, fv.get_statement_type,
                       ['', None, ''])
Esempio n. 6
0
 def test_is_file_structure_valid_returns_true_on_three_headers(self):
     fv = FileValidator()
     result = fv.is_file_structure_valid(['a', 'b', 'c'])
     self.assertTrue(result)
Esempio n. 7
0
 def test_is_file_structure_valid_returns_false_on_empty_headers(self):
     fv = FileValidator()
     result = fv.is_file_structure_valid([])
     self.assertFalse(result)
Esempio n. 8
0
 def test_is_file_structure_valid_returns_false_on_missing_headers(self):
     fv = FileValidator()
     result = fv.is_file_structure_valid(None)
     self.assertFalse(result)
Esempio n. 9
0
 def test_is_file_in_good_dir_returns_false_on_empty_statement(self):
     fv = FileValidator()
     result = fv.is_file_in_good_dir('', 'test_dir')
     self.assertFalse(result)
Esempio n. 10
0
 def test_is_file_in_good_dir_raises_type_error_on_None_statement(self):
     fv = FileValidator()
     self.assertRaises(TypeError, fv.is_file_in_good_dir, None, 'test_dir')
Esempio n. 11
0
 def test_is_file_in_good_dir_returns_false_on_None_dir(self):
     fv = FileValidator()
     result = fv.is_file_in_good_dir('test_statement', '')
     self.assertFalse(result)
Esempio n. 12
0
 def test_is_file_structure_valid_returns_false_on_too_many_headers(self):
     fv = FileValidator()
     result = fv.is_file_structure_valid(['a', 'b', 'c', 'd'])
     self.assertFalse(result)
Esempio n. 13
0
 def test_is_file_in_good_dir_returns_false_on_wrong_dir_for_cash_flow_statement_3(
         self):
     fv = FileValidator()
     result = fv.is_file_in_good_dir('cash_flow_statement',
                                     '/foo/dir/dummy_dir/file.ext')
     self.assertFalse(result)
Esempio n. 14
0
 def test_is_file_in_good_dir_returns_true_for_cash_flow_statement(self):
     fv = FileValidator()
     result = fv.is_file_in_good_dir(
         'cash_flow_statement', '/foo/dir/cash_flow_statement/file.ext')
     self.assertTrue(result)
Esempio n. 15
0
 def test_is_file_in_good_dir_returns_true_for_balance_sheet(self):
     fv = FileValidator()
     result = fv.is_file_in_good_dir('balance_sheet',
                                     '/foo/dir/balance_sheet/file.ext')
     self.assertTrue(result)