Example #1
0
 def test_addtional_charges_with_none_clearing(self):
     assert buildPrices('-',
                        default='student',
                        additional={
                            'employee': '0.20€',
                            'others': 50
                        }) == {}
Example #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
Example #3
0
 def test_addtional_charges(self):
     assert buildPrices(3.64,
                        default='student',
                        additional={
                            'employee': '0.20€',
                            'others': 50
                        }) == self.price_example
Example #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
Example #5
0
    def test_build_from_custom_int_subtype(self):
        class CustomInt(int): pass

        assert buildPrices(
            CustomInt(364),
            default='student',
        ) == self.single_price_example
Example #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
Example #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
Example #8
0
    def test_build_from_custom_int_subtype(self):
        class CustomInt(int):
            pass

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

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

        assert buildPrices(d) == d
Example #10
0
    def test_custom_dict_passthrough(self):
        class CustomDict(dict):
            pass

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

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