Ejemplo n.º 1
0
    def test_gbp_input_for_75cl_bottle_of_wine_at_250_prints_correct_output(self):  # noqa
        gbp_input_for_75cl_bottle_of_wine_at_250 = 'GBP ABC124 2.50'
        expected_output = 'VAT on 75cl bottle of wine worth £2.50 in the United Kingdom is £2.00'  # noqa

        actual_output = parse(gbp_input_for_75cl_bottle_of_wine_at_250)

        self.assertEqual(actual_output, expected_output)
Ejemplo n.º 2
0
    def test_input_currency_is_not_covered_so_output_should_show_tax_at_10_percent(self):  # noqa
        input_for_bread_at_350 = 'NULL ABC123 3.50'
        output_for_bread_at_350 = 'VAT on Bread worth 3.50 in the rest of the world is 0.35 (10%)'  # noqa

        actual_output = parse(input_for_bread_at_350)

        self.assertEqual(actual_output, output_for_bread_at_350)
Ejemplo n.º 3
0
    def test_gbp_input_for_bread_at_250_prints_correct_output(self):
        gbp_input_for_bread_at_250 = 'GBP ABC123 2.50'
        gbp_output_for_bread_at_250 = 'VAT on Bread worth £2.50 in the United Kingdom is £0.50 (20%)'  # noqa

        actual_output = parse(gbp_input_for_bread_at_250)

        self.assertEqual(actual_output, gbp_output_for_bread_at_250)
Ejemplo n.º 4
0
    def test_de_tax_on_cigarettes_is_30_percent(self):
        de_input = 'EUR ABC125 2.50 DE'
        expected_output = 'VAT on Cigarettes worth €2.50 in the Germany is €0.15 (30% with the first €2.00 non taxable)'  # noqa

        actual_output = parse(de_input)

        self.assertEqual(actual_output, expected_output)
Ejemplo n.º 5
0
    def test_de_tax_is_extracted_with_de_on_end_of_input_and_output_is_correct(self):  # noqa
        de_input = 'EUR ABC123 2.50 DE'
        expected_output = 'VAT on Bread worth €2.50 in the Germany is €0.05 (10% with the first €2.00 non taxable)'  # noqa

        actual_output = parse(de_input)

        self.assertEqual(actual_output, expected_output)
Ejemplo n.º 6
0
    def test_gbp_cigarettes_is_taxed_at_25_percent(self):
        gbp_input = 'GBP ABC125 2.50'
        expected_output = 'VAT on Cigarettes worth £2.50 in the United Kingdom is £0.62 (25%)'  # noqa

        actual_output = parse(gbp_input)

        self.assertEqual(actual_output, expected_output)
Ejemplo n.º 7
0
    def test_eur_default_input_returns_euro_rule_with_default_tax_rate(self):
        eur_input = 'EUR ABC123 2.50'
        expected_output = 'VAT on Bread worth €2.50 in the Generic European Country is €0.25 (10%)'  # noqa

        actual_output = parse(eur_input)

        self.assertEqual(actual_output, expected_output)
Ejemplo n.º 8
0
    def test_can_parse_sys_argv_input(self):
        # sys.argv is a list so we'll just create a list
        # pretend the list has already had first element
        # removed, which is the program name
        list_input = ['GBP', 'ABC123', '2.50']
        expected_output = 'VAT on Bread worth £2.50 in the United Kingdom is £0.50 (20%)'  # noqa

        actual_output = parse(list_input)

        self.assertEqual(actual_output, expected_output)
Ejemplo n.º 9
0
#!/usr/bin/env python3

from taxcalculator.parser import parse
import sys

if __name__ == '__main__':
    tax_output = parse(sys.argv[1:])

    print(tax_output)