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

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

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

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

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

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

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