Author: russellm
Date: 2010-09-28 20:29:10 -0500 (Tue, 28 Sep 2010)
New Revision: 13959
Modified:
django/branches/releases/1.2.X/tests/regressiontests/fixtures_regress/tests.py
Log:
[1.2.X] Modified a fixtures_regress test case to make it more robust to
database ordering.
Backport of r13958 from trunk.
Modified:
django/branches/releases/1.2.X/tests/regressiontests/fixtures_regress/tests.py
===================================================================
---
django/branches/releases/1.2.X/tests/regressiontests/fixtures_regress/tests.py
2010-09-29 01:20:34 UTC (rev 13958)
+++
django/branches/releases/1.2.X/tests/regressiontests/fixtures_regress/tests.py
2010-09-29 01:29:10 UTC (rev 13959)
@@ -304,11 +304,18 @@
format='json',
stdout=stdout
)
- self.assertEqual(
- stdout.getvalue(),
- """[{"pk": 1, "model": "fixtures_regress.animal", "fields":
{"count": 3, "weight": 1.2, "name": "Lion", "latin_name": "Panthera leo"}},
{"pk": 10, "model": "fixtures_regress.animal", "fields": {"count": 42,
"weight": 1.2, "name": "Emu", "latin_name": "Dromaius novaehollandiae"}},
{"pk": 11, "model": "fixtures_regress.animal", "fields": {"count": 2, "weight":
2.2000000000000002, "name": "Platypus", "latin_name": "Ornithorhynchus
anatinus"}}]"""
- )
+ # Output order isn't guaranteed, so check for parts
+ data = stdout.getvalue()
+ 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"}}'
+
+ self.assertEqual(len(data), len('[%s]' % ', '.join([lion_json,
emu_json, platypus_json])))
+ self.assertTrue(lion_json in data)
+ self.assertTrue(emu_json in data)
+ self.assertTrue(platypus_json in data)
+
def test_proxy_model_included(self):
"""
Regression for #11428 - Proxy models aren't included when you dumpdata
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.