Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #13799, a test failure on Postgres. Thanks, Alex.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@13400 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 6eafd412fcb41dc2866f6a1f27dfb4941f999aa7 1 parent 7773a92
Jacob Kaplan-Moss authored June 23, 2010
18  tests/regressiontests/m2m_through_regress/tests.py
@@ -66,11 +66,13 @@ def test_serialization(self):
66 66
 
67 67
         p = Person.objects.create(name="Bob")
68 68
         g = Group.objects.create(name="Roll")
69  
-        Membership.objects.create(person=p, group=g)
  69
+        m =Membership.objects.create(person=p, group=g)
  70
+
  71
+        pks = {"p_pk": p.pk, "g_pk": g.pk, "m_pk": m.pk}
70 72
 
71 73
         out = StringIO()
72 74
         management.call_command("dumpdata", "m2m_through_regress", format="json", stdout=out)
73  
-        self.assertEqual(out.getvalue().strip(), """[{"pk": 1, "model": "m2m_through_regress.membership", "fields": {"person": 1, "price": 100, "group": 1}}, {"pk": 1, "model": "m2m_through_regress.person", "fields": {"name": "Bob"}}, {"pk": 1, "model": "m2m_through_regress.group", "fields": {"name": "Roll"}}]""")
  75
+        self.assertEqual(out.getvalue().strip(), """[{"pk": %(m_pk)s, "model": "m2m_through_regress.membership", "fields": {"person": %(p_pk)s, "price": 100, "group": %(g_pk)s}}, {"pk": %(p_pk)s, "model": "m2m_through_regress.person", "fields": {"name": "Bob"}}, {"pk": %(g_pk)s, "model": "m2m_through_regress.group", "fields": {"name": "Roll"}}]""" % pks)
74 76
 
75 77
         out = StringIO()
76 78
         management.call_command("dumpdata", "m2m_through_regress", format="xml",
@@ -78,19 +80,19 @@ def test_serialization(self):
78 80
         self.assertEqual(out.getvalue().strip(), """
79 81
 <?xml version="1.0" encoding="utf-8"?>
80 82
 <django-objects version="1.0">
81  
-  <object pk="1" model="m2m_through_regress.membership">
82  
-    <field to="m2m_through_regress.person" name="person" rel="ManyToOneRel">1</field>
83  
-    <field to="m2m_through_regress.group" name="group" rel="ManyToOneRel">1</field>
  83
+  <object pk="%(m_pk)s" model="m2m_through_regress.membership">
  84
+    <field to="m2m_through_regress.person" name="person" rel="ManyToOneRel">%(p_pk)s</field>
  85
+    <field to="m2m_through_regress.group" name="group" rel="ManyToOneRel">%(g_pk)s</field>
84 86
     <field type="IntegerField" name="price">100</field>
85 87
   </object>
86  
-  <object pk="1" model="m2m_through_regress.person">
  88
+  <object pk="%(p_pk)s" model="m2m_through_regress.person">
87 89
     <field type="CharField" name="name">Bob</field>
88 90
   </object>
89  
-  <object pk="1" model="m2m_through_regress.group">
  91
+  <object pk="%(g_pk)s" model="m2m_through_regress.group">
90 92
     <field type="CharField" name="name">Roll</field>
91 93
   </object>
92 94
 </django-objects>
93  
-        """.strip())
  95
+        """.strip() % pks)
94 96
 
95 97
     def test_join_trimming(self):
96 98
         "Check that we don't involve too many copies of the intermediate table when doing a join. Refs #8046, #8254"

0 notes on commit 6eafd41

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