Esempio n. 1
0
 def test_addtional_charges_with_none_clearing(self):
     assert buildPrices('-',
                        default='student',
                        additional={
                            'employee': '0.20€',
                            'others': 50
                        }) == {}
Esempio n. 2
0
    def test_build_from_custom_str_subtype(self):
        class CustomStr(str): pass

        assert buildPrices(
            CustomStr('3.64€'),
            default='student',
        ) == self.single_price_example
Esempio n. 3
0
 def test_addtional_charges(self):
     assert buildPrices(3.64,
                        default='student',
                        additional={
                            'employee': '0.20€',
                            'others': 50
                        }) == self.price_example
Esempio n. 4
0
    def test_build_from_custom_float_subtype(self):
        class CustomFloat(float): pass

        assert buildPrices(
            CustomFloat(3.64),
            default='student',
        ) == self.single_price_example
Esempio n. 5
0
    def test_build_from_custom_int_subtype(self):
        class CustomInt(int): pass

        assert buildPrices(
            CustomInt(364),
            default='student',
        ) == self.single_price_example
Esempio n. 6
0
    def test_build_from_custom_float_subtype(self):
        class CustomFloat(float):
            pass

        assert buildPrices(
            CustomFloat(3.64),
            default='student',
        ) == self.single_price_example
Esempio n. 7
0
    def test_build_from_custom_str_subtype(self):
        class CustomStr(str):
            pass

        assert buildPrices(
            CustomStr('3.64€'),
            default='student',
        ) == self.single_price_example
Esempio n. 8
0
    def test_build_from_custom_int_subtype(self):
        class CustomInt(int):
            pass

        assert buildPrices(
            CustomInt(364),
            default='student',
        ) == self.single_price_example
Esempio n. 9
0
    def test_custom_dict_passthrough(self):
        class CustomDict(dict): pass

        d = CustomDict()
        d['student'] = 354
        d['other'] = 375

        assert buildPrices(d) == d
Esempio n. 10
0
    def test_custom_dict_passthrough(self):
        class CustomDict(dict):
            pass

        d = CustomDict()
        d['student'] = 354
        d['other'] = 375

        assert buildPrices(d) == d
Esempio n. 11
0
    def test_build_from_prices_and_roles_with_custom_types(self):
        class CustomStr(str): pass
        class CustomFloat(float): pass
        class CustomInt(int): pass

        assert buildPrices(
            [CustomStr('3.64€'), CustomFloat(3.84), CustomInt(414)],
            ('student', 'employee', 'others')
        ) == self.price_example
Esempio n. 12
0
 def test_addtional_charges_with_none_clearing2(self):
     assert buildPrices(364,
                        default='student',
                        additional={
                            'employee': '-',
                            'others': 50
                        }) == {
                            'student': 364,
                            'others': 414
                        }
Esempio n. 13
0
    def test_build_from_prices_and_roles_with_custom_types(self):
        class CustomStr(str):
            pass

        class CustomFloat(float):
            pass

        class CustomInt(int):
            pass

        assert buildPrices(
            [CustomStr('3.64€'),
             CustomFloat(3.84),
             CustomInt(414)],
            ('student', 'employee', 'others')) == self.price_example
Esempio n. 14
0
 def test_addtional_charges(self):
     assert buildPrices(
         3.64,
         default='student',
         additional={'employee': '0.20€', 'others': 50}
     ) == self.price_example
Esempio n. 15
0
 def test_build_from_prices_and_roles_with_complete_none_clearing(self):
     assert buildPrices(
         ['-', '-', '  -   '],
         ('student', 'employee', 'others')
     ) == {}
Esempio n. 16
0
 def test_build_from_prices_and_roles_with_none_clearing(self):
     assert buildPrices(
         ['3.64€', '-', '  -   '],
         ('student', 'employee', 'others')
     ) == self.single_price_example
Esempio n. 17
0
 def test_build_from_prices_and_roles(self):
     assert buildPrices(
         ['3.64€', 3.84, 414],
         ('student', 'employee', 'others')
     ) == self.price_example
Esempio n. 18
0
 def test_dict_converting_with_complete_none_clearing(self):
     d = {
         'student': '-',
         'other': '  -   '
     }
     assert buildPrices(d) == {}
Esempio n. 19
0
 def test_dict_type_converting(self):
     d = {'student': '3.64 €', 'employee': 3.84, 'others': 414}
     assert buildPrices(d) == self.price_example
Esempio n. 20
0
 def test_build_from_prices_and_roles_with_complete_none_clearing(self):
     assert buildPrices(['-', '-', '  -   '],
                        ('student', 'employee', 'others')) == {}
Esempio n. 21
0
 def test_addtional_charges_with_none_clearing(self):
     assert buildPrices(
         '-',
         default='student',
         additional={'employee': '0.20€', 'others': 50}
     ) == {}
Esempio n. 22
0
 def test_dict_type_converting(self):
     d = {'student': '3.64 €', 'employee': 3.84, 'others': 414}
     assert buildPrices(d) == self.price_example
Esempio n. 23
0
 def test_dict_converting_with_complete_none_clearing(self):
     d = {'student': '-', 'other': '  -   '}
     assert buildPrices(d) == {}
Esempio n. 24
0
 def test_build_from_prices_and_roles(self):
     assert buildPrices(
         ['3.64€', 3.84, 414],
         ('student', 'employee', 'others')) == self.price_example
Esempio n. 25
0
 def test_addtional_charges_with_none_clearing2(self):
     assert buildPrices(
         364,
         default='student',
         additional={'employee': '-', 'others': 50}
     ) == {'student': 364, 'others': 414}
Esempio n. 26
0
 def test_build_from_prices_and_roles_with_none_clearing(self):
     assert buildPrices(
         ['3.64€', '-', '  -   '],
         ('student', 'employee', 'others')) == self.single_price_example
Esempio n. 27
0
 def test_wrong_price_types(self):
     with pytest.raises(TypeError):
         buildPrices(True)
     with pytest.raises(TypeError):
         buildPrices(None)
Esempio n. 28
0
 def test_dict_passthrought(self):
     d = {
         'student': 354,
         'other': 375
     }
     assert buildPrices(d) == d
Esempio n. 29
0
 def test_wrong_price_types(self):
     with pytest.raises(TypeError):
         buildPrices(True)
     with pytest.raises(TypeError):
         buildPrices(None)
Esempio n. 30
0
 def test_dict_passthrought(self):
     d = {'student': 354, 'other': 375}
     assert buildPrices(d) == d