コード例 #1
0
ファイル: test_prices.py プロジェクト: mswart/pyopenmensa
 def test_addtional_charges_with_none_clearing(self):
     assert buildPrices('-',
                        default='student',
                        additional={
                            'employee': '0.20€',
                            'others': 50
                        }) == {}
コード例 #2
0
ファイル: test_prices.py プロジェクト: azrdev/pyopenmensa
    def test_build_from_custom_str_subtype(self):
        class CustomStr(str): pass

        assert buildPrices(
            CustomStr('3.64€'),
            default='student',
        ) == self.single_price_example
コード例 #3
0
ファイル: test_prices.py プロジェクト: mswart/pyopenmensa
 def test_addtional_charges(self):
     assert buildPrices(3.64,
                        default='student',
                        additional={
                            'employee': '0.20€',
                            'others': 50
                        }) == self.price_example
コード例 #4
0
ファイル: test_prices.py プロジェクト: azrdev/pyopenmensa
    def test_build_from_custom_float_subtype(self):
        class CustomFloat(float): pass

        assert buildPrices(
            CustomFloat(3.64),
            default='student',
        ) == self.single_price_example
コード例 #5
0
ファイル: test_prices.py プロジェクト: azrdev/pyopenmensa
    def test_build_from_custom_int_subtype(self):
        class CustomInt(int): pass

        assert buildPrices(
            CustomInt(364),
            default='student',
        ) == self.single_price_example
コード例 #6
0
ファイル: test_prices.py プロジェクト: mswart/pyopenmensa
    def test_build_from_custom_float_subtype(self):
        class CustomFloat(float):
            pass

        assert buildPrices(
            CustomFloat(3.64),
            default='student',
        ) == self.single_price_example
コード例 #7
0
ファイル: test_prices.py プロジェクト: mswart/pyopenmensa
    def test_build_from_custom_str_subtype(self):
        class CustomStr(str):
            pass

        assert buildPrices(
            CustomStr('3.64€'),
            default='student',
        ) == self.single_price_example
コード例 #8
0
ファイル: test_prices.py プロジェクト: mswart/pyopenmensa
    def test_build_from_custom_int_subtype(self):
        class CustomInt(int):
            pass

        assert buildPrices(
            CustomInt(364),
            default='student',
        ) == self.single_price_example
コード例 #9
0
ファイル: test_prices.py プロジェクト: azrdev/pyopenmensa
    def test_custom_dict_passthrough(self):
        class CustomDict(dict): pass

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

        assert buildPrices(d) == d
コード例 #10
0
ファイル: test_prices.py プロジェクト: mswart/pyopenmensa
    def test_custom_dict_passthrough(self):
        class CustomDict(dict):
            pass

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

        assert buildPrices(d) == d
コード例 #11
0
ファイル: test_prices.py プロジェクト: azrdev/pyopenmensa
    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
コード例 #12
0
ファイル: test_prices.py プロジェクト: mswart/pyopenmensa
 def test_addtional_charges_with_none_clearing2(self):
     assert buildPrices(364,
                        default='student',
                        additional={
                            'employee': '-',
                            'others': 50
                        }) == {
                            'student': 364,
                            'others': 414
                        }
コード例 #13
0
ファイル: test_prices.py プロジェクト: mswart/pyopenmensa
    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
コード例 #14
0
ファイル: test_prices.py プロジェクト: azrdev/pyopenmensa
 def test_addtional_charges(self):
     assert buildPrices(
         3.64,
         default='student',
         additional={'employee': '0.20€', 'others': 50}
     ) == self.price_example
コード例 #15
0
ファイル: test_prices.py プロジェクト: azrdev/pyopenmensa
 def test_build_from_prices_and_roles_with_complete_none_clearing(self):
     assert buildPrices(
         ['-', '-', '  -   '],
         ('student', 'employee', 'others')
     ) == {}
コード例 #16
0
ファイル: test_prices.py プロジェクト: azrdev/pyopenmensa
 def test_build_from_prices_and_roles_with_none_clearing(self):
     assert buildPrices(
         ['3.64€', '-', '  -   '],
         ('student', 'employee', 'others')
     ) == self.single_price_example
コード例 #17
0
ファイル: test_prices.py プロジェクト: azrdev/pyopenmensa
 def test_build_from_prices_and_roles(self):
     assert buildPrices(
         ['3.64€', 3.84, 414],
         ('student', 'employee', 'others')
     ) == self.price_example
コード例 #18
0
ファイル: test_prices.py プロジェクト: azrdev/pyopenmensa
 def test_dict_converting_with_complete_none_clearing(self):
     d = {
         'student': '-',
         'other': '  -   '
     }
     assert buildPrices(d) == {}
コード例 #19
0
ファイル: test_prices.py プロジェクト: azrdev/pyopenmensa
 def test_dict_type_converting(self):
     d = {'student': '3.64 €', 'employee': 3.84, 'others': 414}
     assert buildPrices(d) == self.price_example
コード例 #20
0
ファイル: test_prices.py プロジェクト: mswart/pyopenmensa
 def test_build_from_prices_and_roles_with_complete_none_clearing(self):
     assert buildPrices(['-', '-', '  -   '],
                        ('student', 'employee', 'others')) == {}
コード例 #21
0
ファイル: test_prices.py プロジェクト: azrdev/pyopenmensa
 def test_addtional_charges_with_none_clearing(self):
     assert buildPrices(
         '-',
         default='student',
         additional={'employee': '0.20€', 'others': 50}
     ) == {}
コード例 #22
0
ファイル: test_prices.py プロジェクト: mswart/pyopenmensa
 def test_dict_type_converting(self):
     d = {'student': '3.64 €', 'employee': 3.84, 'others': 414}
     assert buildPrices(d) == self.price_example
コード例 #23
0
ファイル: test_prices.py プロジェクト: mswart/pyopenmensa
 def test_dict_converting_with_complete_none_clearing(self):
     d = {'student': '-', 'other': '  -   '}
     assert buildPrices(d) == {}
コード例 #24
0
ファイル: test_prices.py プロジェクト: mswart/pyopenmensa
 def test_build_from_prices_and_roles(self):
     assert buildPrices(
         ['3.64€', 3.84, 414],
         ('student', 'employee', 'others')) == self.price_example
コード例 #25
0
ファイル: test_prices.py プロジェクト: azrdev/pyopenmensa
 def test_addtional_charges_with_none_clearing2(self):
     assert buildPrices(
         364,
         default='student',
         additional={'employee': '-', 'others': 50}
     ) == {'student': 364, 'others': 414}
コード例 #26
0
ファイル: test_prices.py プロジェクト: mswart/pyopenmensa
 def test_build_from_prices_and_roles_with_none_clearing(self):
     assert buildPrices(
         ['3.64€', '-', '  -   '],
         ('student', 'employee', 'others')) == self.single_price_example
コード例 #27
0
ファイル: test_prices.py プロジェクト: mswart/pyopenmensa
 def test_wrong_price_types(self):
     with pytest.raises(TypeError):
         buildPrices(True)
     with pytest.raises(TypeError):
         buildPrices(None)
コード例 #28
0
ファイル: test_prices.py プロジェクト: azrdev/pyopenmensa
 def test_dict_passthrought(self):
     d = {
         'student': 354,
         'other': 375
     }
     assert buildPrices(d) == d
コード例 #29
0
ファイル: test_prices.py プロジェクト: azrdev/pyopenmensa
 def test_wrong_price_types(self):
     with pytest.raises(TypeError):
         buildPrices(True)
     with pytest.raises(TypeError):
         buildPrices(None)
コード例 #30
0
ファイル: test_prices.py プロジェクト: mswart/pyopenmensa
 def test_dict_passthrought(self):
     d = {'student': 354, 'other': 375}
     assert buildPrices(d) == d