Skip to content

Commit

Permalink
Merge pull request #452 from Stranger6667/fix-pymoneyed-compatibility
Browse files Browse the repository at this point in the history
Update tests for `py-moneyed==0.8` behavior
  • Loading branch information
benjaoming committed Dec 23, 2018
2 parents 8fef77c + 01d0c6f commit 699d562
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def run_tests(self):
install_requires=[
'setuptools',
'Django>=1.8',
'py-moneyed>=0.7'
'py-moneyed>=0.8'
],
platforms=['Any'],
keywords=['django', 'py-money', 'money'],
Expand Down
10 changes: 5 additions & 5 deletions tests/test_form.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,12 @@ def test_no_deprecation_warning():
class TestValidation:

@pytest.mark.parametrize('value, error', (
(Money(50, 'EUR'), 'Ensure this value is greater than or equal to 100.00 EUR.'),
(Money(1500, 'EUR'), 'Ensure this value is less than or equal to 1,000.00 EUR.'),
(Money(50, 'EUR'), u'Ensure this value is greater than or equal to 100.00 .'),
(Money(1500, 'EUR'), u'Ensure this value is less than or equal to 1,000.00 .'),
(Money(40, 'USD'), 'Ensure this value is greater than or equal to $50.00.'),
(Money(600, 'USD'), 'Ensure this value is less than or equal to $500.00.'),
(Money(400, 'NOK'), 'Ensure this value is greater than or equal to 500.00 NOK.'),
(Money(950, 'NOK'), 'Ensure this value is less than or equal to 900.00 NOK.'),
(Money(400, 'NOK'), 'Ensure this value is greater than or equal to 500.00 Nkr.'),
(Money(950, 'NOK'), 'Ensure this value is less than or equal to 900.00 Nkr.'),
(Money(5, 'SEK'), 'Ensure this value is greater than or equal to 10.'),
(Money(1600, 'SEK'), 'Ensure this value is less than or equal to 1500.'),
))
Expand Down Expand Up @@ -190,7 +190,7 @@ def test_positive_validator(self, value):
def test_default_django_validator(self):
form = MoneyModelFormWithValidation(data={'balance_0': 0, 'balance_1': 'GBP'})
assert not form.is_valid()
assert form.errors == {'balance': ['Ensure this value is greater than or equal to 100.00 GBP.']}
assert form.errors == {'balance': [u'Ensure this value is greater than or equal to GB£100.00.']}


@pytest.mark.skipif(VERSION[:2] == (1, 8), reason="Django 1.8 doesn't have `disabled` keyword in fields")
Expand Down
2 changes: 1 addition & 1 deletion tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,7 @@ def test_override_decorator():
When current locale is changed, Money instances should be represented correctly.
"""
with override('cs'):
assert str(Money(10, 'CZK')) == 'Kč10.00'
assert str(Money(10, 'CZK')) == '10.00'


def test_deprecation():
Expand Down
2 changes: 1 addition & 1 deletion tests/test_money.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def test_repr():


def test_html_safe():
assert Money('10.5', 'EUR').__html__() == u'10.50\xa0EUR'
assert Money('10.5', 'EUR').__html__() == u'10.50\xa0'


def test_html_unsafe():
Expand Down

0 comments on commit 699d562

Please sign in to comment.