Author: lukeplant
Date: 2010-10-21 09:56:18 -0500 (Thu, 21 Oct 2010)
New Revision: 14309

Modified:
   django/trunk/tests/regressiontests/fixtures_regress/tests.py
Log:
Fixed test failure when using Python 2.7

Modified: django/trunk/tests/regressiontests/fixtures_regress/tests.py
===================================================================
--- django/trunk/tests/regressiontests/fixtures_regress/tests.py        
2010-10-21 06:01:02 UTC (rev 14308)
+++ django/trunk/tests/regressiontests/fixtures_regress/tests.py        
2010-10-21 14:56:18 UTC (rev 14309)
@@ -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 @@
 
         # 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)

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to