Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed test failure when using Python 2.7

git-svn-id: http://code.djangoproject.com/svn/django/trunk@14309 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 7e19641b0359c23105cc27eebd9ccb1963546f2a 1 parent 7f84dac
Luke Plant authored October 21, 2010
8  tests/regressiontests/fixtures_regress/tests.py
... ...
@@ -1,6 +1,7 @@
1 1
 # -*- coding: utf-8 -*-
2 2
 # Unittests for fixtures.
3 3
 import os
  4
+import re
4 5
 import sys
5 6
 try:
6 7
     from cStringIO import StringIO
@@ -307,9 +308,14 @@ def test_dumpdata_uses_default_manager(self):
307 308
 
308 309
         # Output order isn't guaranteed, so check for parts
309 310
         data = stdout.getvalue()
  311
+
  312
+        # Get rid of artifacts like '000000002' to eliminate the differences
  313
+        # between different Python versions.
  314
+        data = re.sub('0{6,}\d', '', data)
  315
+
310 316
         lion_json = '{"pk": 1, "model": "fixtures_regress.animal", "fields": {"count": 3, "weight": 1.2, "name": "Lion", "latin_name": "Panthera leo"}}'
311 317
         emu_json = '{"pk": 10, "model": "fixtures_regress.animal", "fields": {"count": 42, "weight": 1.2, "name": "Emu", "latin_name": "Dromaius novaehollandiae"}}'
312  
-        platypus_json = '{"pk": 11, "model": "fixtures_regress.animal", "fields": {"count": 2, "weight": 2.2000000000000002, "name": "Platypus", "latin_name": "Ornithorhynchus anatinus"}}'
  318
+        platypus_json = '{"pk": 11, "model": "fixtures_regress.animal", "fields": {"count": 2, "weight": 2.2, "name": "Platypus", "latin_name": "Ornithorhynchus anatinus"}}'
313 319
 
314 320
         self.assertEqual(len(data), len('[%s]' % ', '.join([lion_json, emu_json, platypus_json])))
315 321
         self.assertTrue(lion_json in data)

0 notes on commit 7e19641

Please sign in to comment.
Something went wrong with that request. Please try again.