diff options
| author | Luke Plant <L.Plant.98@cantab.net> | 2010-10-21 14:56:18 +0000 |
|---|---|---|
| committer | Luke Plant <L.Plant.98@cantab.net> | 2010-10-21 14:56:18 +0000 |
| commit | 7e19641b0359c23105cc27eebd9ccb1963546f2a (patch) | |
| tree | d1532db31c892a932f9d2aef2e99fd01ca75ee39 /tests | |
| parent | 7f84dac3c7cdbbd073a6b8cdb07033dd4a53608e (diff) | |
Fixed test failure when using Python 2.7
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14309 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/regressiontests/fixtures_regress/tests.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/tests/regressiontests/fixtures_regress/tests.py b/tests/regressiontests/fixtures_regress/tests.py index 3fe026d5a7..e37272aae1 100644 --- a/tests/regressiontests/fixtures_regress/tests.py +++ b/tests/regressiontests/fixtures_regress/tests.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- # Unittests for fixtures. import os +import re import sys try: from cStringIO import StringIO @@ -307,9 +308,14 @@ class TestFixtures(TestCase): # Output order isn't guaranteed, so check for parts data = stdout.getvalue() + + # Get rid of artifacts like '000000002' to eliminate the differences + # between different Python versions. + data = re.sub('0{6,}\d', '', data) + lion_json = '{"pk": 1, "model": "fixtures_regress.animal", "fields": {"count": 3, "weight": 1.2, "name": "Lion", "latin_name": "Panthera leo"}}' emu_json = '{"pk": 10, "model": "fixtures_regress.animal", "fields": {"count": 42, "weight": 1.2, "name": "Emu", "latin_name": "Dromaius novaehollandiae"}}' - platypus_json = '{"pk": 11, "model": "fixtures_regress.animal", "fields": {"count": 2, "weight": 2.2000000000000002, "name": "Platypus", "latin_name": "Ornithorhynchus anatinus"}}' + platypus_json = '{"pk": 11, "model": "fixtures_regress.animal", "fields": {"count": 2, "weight": 2.2, "name": "Platypus", "latin_name": "Ornithorhynchus anatinus"}}' self.assertEqual(len(data), len('[%s]' % ', '.join([lion_json, emu_json, platypus_json]))) self.assertTrue(lion_json in data) |
