diff options
| author | Tom Christie | 2014-09-22 16:45:06 +0100 | 
|---|---|---|
| committer | Tom Christie | 2014-09-22 16:45:06 +0100 | 
| commit | e5f0a97595ff9280c7876fc917f6feb27b5ea95d (patch) | |
| tree | ad57f4bc221d92e34422517b947dc3c2d39b8ec3 /tests | |
| parent | 5586b6581d9d8db05276c08f2c6deffec04ade4f (diff) | |
| download | django-rest-framework-e5f0a97595ff9280c7876fc917f6feb27b5ea95d.tar.bz2 | |
More compat fixes
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test_fields.py | 10 | 
1 files changed, 6 insertions, 4 deletions
| diff --git a/tests/test_fields.py b/tests/test_fields.py index b221089c..8c50aaba 100644 --- a/tests/test_fields.py +++ b/tests/test_fields.py @@ -2,6 +2,7 @@ from decimal import Decimal  from django.utils import timezone  from rest_framework import fields  import datetime +import django  import pytest @@ -92,7 +93,7 @@ class TestEmailField(FieldValues):          ' example@example.com ': 'example@example.com',      }      invalid_inputs = { -        'example.com': ['Enter a valid email address.'] +        'examplecom': ['Enter a valid email address.']      }      outputs = {}      field = fields.EmailField() @@ -267,8 +268,8 @@ class TestMinMaxDecimalField(FieldValues):      Valid and invalid values for `DecimalField` with min and max limits.      """      valid_inputs = { -        '10.0': 10.0, -        '20.0': 20.0, +        '10.0': Decimal('10.0'), +        '20.0': Decimal('20.0'),      }      invalid_inputs = {          '9.9': ['Ensure this value is greater than or equal to 10.'], @@ -368,9 +369,10 @@ class TestDateTimeField(FieldValues):          '2001-01-01 13:00': datetime.datetime(2001, 1, 1, 13, 00, tzinfo=timezone.UTC()),          '2001-01-01T13:00': datetime.datetime(2001, 1, 1, 13, 00, tzinfo=timezone.UTC()),          '2001-01-01T13:00Z': datetime.datetime(2001, 1, 1, 13, 00, tzinfo=timezone.UTC()), -        '2001-01-01T14:00+0100': datetime.datetime(2001, 1, 1, 13, 00, tzinfo=timezone.UTC()),          datetime.datetime(2001, 1, 1, 13, 00): datetime.datetime(2001, 1, 1, 13, 00, tzinfo=timezone.UTC()),          datetime.datetime(2001, 1, 1, 13, 00, tzinfo=timezone.UTC()): datetime.datetime(2001, 1, 1, 13, 00, tzinfo=timezone.UTC()), +        # Note that 1.4 does not support timezone string parsing. +        '2001-01-01T14:00+01:00' if (django.VERSION > (1, 4)) else '2001-01-01T13:00Z': datetime.datetime(2001, 1, 1, 13, 00, tzinfo=timezone.UTC())      }      invalid_inputs = {          'abc': ['Datetime has wrong format. Use one of these formats instead: YYYY-MM-DDThh:mm[:ss[.uuuuuu]][+HH:MM|-HH:MM|Z]'], | 
