def test_date_range_without_space(self): key = 'Fakturaperiod' text = 'Fakturaperiod 2018 11 01-2018 12 01' expected_result = ['2018 11 01-2018 12 01'] self.assertEqual(invoice_parser.find_key(key, text), expected_result)
def test_wrong_anl_nr(self): key = 'Anl.nr' text = 'Anl.nr: 4191060' self.assertIsNone(invoice_parser.find_key(key, text))
def test_wrong_meter_nr(self): key = 'Mätarnr' text = 'Mätarnr 1234 5' self.assertIsNone(invoice_parser.find_key(key, text))
def test_price_without_currency_id(self): key = 'Summa exkl. moms' text = 'Summa exkl. moms ' \ '163 783,81' self.assertIsNone(invoice_parser.find_key(key, text))
def test_price_with_two_spaces(self): key = 'Summa exkl. moms' text = 'Summa exkl. moms ' \ '2 163 783,81 kr ' expected_result = ['163 783,81'] self.assertEqual(invoice_parser.find_key(key, text), expected_result)
def test_proper_price_million(self): key = 'Summa exkl. moms' text = 'Summa exkl. moms ' \ '234 163 783,81 kr ' expected_result = ['234 163 783,81'] self.assertEqual(invoice_parser.find_key(key, text), expected_result)
def test_proper_price_thousand(self): key = 'Summa exkl. moms' text = 'Summa exkl. moms ' \ ' 16 783,81 kr ' expected_result = ['16 783,81'] self.assertEqual(invoice_parser.find_key(key, text), expected_result)
def test_date_different_delimiters(self): key = 'Fakturaperiod' text = 'Fakturaperiod 2018/11/01 - 2018/12/01' expected_result = ['2018/11/01 - 2018/12/01'] self.assertEqual(invoice_parser.find_key(key, text), expected_result)