Author: kmtracey
Date: 2010-09-10 13:11:25 -0500 (Fri, 10 Sep 2010)
New Revision: 13714

Modified:
   django/branches/releases/1.2.X/
   
django/branches/releases/1.2.X/tests/regressiontests/aggregation_regress/tests.py
Log:
[1.2.X] Fixed #14246: Modified aggregation_regress tests so that they will pass 
on a variety (sqlite, Postgres, MySQL/MyISAM) of DBs. 

r13712 from trunk.



Property changes on: django/branches/releases/1.2.X
___________________________________________________________________
Name: svnmerge-integrated
   - 
/django/trunk:1-13360,13434,13480,13574,13600,13638,13652,13664,13666,13668,13680,13683,13685,13687-13688,13690,13694,13696,13701-13702,13705,13709
   + 
/django/trunk:1-13360,13434,13480,13574,13600,13638,13652,13664,13666,13668,13680,13683,13685,13687-13688,13690,13694,13696,13701-13702,13705,13709,13712

Modified: 
django/branches/releases/1.2.X/tests/regressiontests/aggregation_regress/tests.py
===================================================================
--- 
django/branches/releases/1.2.X/tests/regressiontests/aggregation_regress/tests.py
   2010-09-10 18:09:18 UTC (rev 13713)
+++ 
django/branches/releases/1.2.X/tests/regressiontests/aggregation_regress/tests.py
   2010-09-10 18:11:25 UTC (rev 13714)
@@ -135,7 +135,6 @@
             contact_id=3,
             id=2,
             isbn=u'067232959',
-            manufacture_cost=11.545,
             mean_auth_age=45.0,
             name='Sams Teach Yourself Django in 24 Hours',
             pages=528,
@@ -144,6 +143,8 @@
             publisher_id=2,
             rating=3.0
         )
+        # Different DB backends return different types for the extra select 
computation
+        self.assertTrue(obj.manufacture_cost == 11.545 or obj.manufacture_cost 
== Decimal('11.545'))
 
         # Order of the annotate/extra in the query doesn't matter
         obj = Book.objects.extra(select={'manufacture_cost' : 'price * 
.5'}).annotate(mean_auth_age=Avg('authors__age')).get(pk=2)
@@ -151,7 +152,6 @@
             contact_id=3,
             id=2,
             isbn=u'067232959',
-            manufacture_cost=11.545,
             mean_auth_age=45.0,
             name=u'Sams Teach Yourself Django in 24 Hours',
             pages=528,
@@ -160,14 +160,18 @@
             publisher_id=2,
             rating=3.0
         )
+        # Different DB backends return different types for the extra select 
computation
+        self.assertTrue(obj.manufacture_cost == 11.545 or obj.manufacture_cost 
== Decimal('11.545'))
 
         # Values queries can be combined with annotate and extra
         obj = 
Book.objects.annotate(mean_auth_age=Avg('authors__age')).extra(select={'manufacture_cost'
 : 'price * .5'}).values().get(pk=2)
+        manufacture_cost = obj['manufacture_cost']
+        self.assertTrue(manufacture_cost == 11.545 or manufacture_cost == 
Decimal('11.545'))
+        del obj['manufacture_cost']
         self.assertEqual(obj, {
             "contact_id": 3,
             "id": 2,
             "isbn": u"067232959",
-            "manufacture_cost": 11.545,
             "mean_auth_age": 45.0,
             "name": u"Sams Teach Yourself Django in 24 Hours",
             "pages": 528,
@@ -180,11 +184,13 @@
         # The order of the (empty) values, annotate and extra clauses doesn't
         # matter
         obj = 
Book.objects.values().annotate(mean_auth_age=Avg('authors__age')).extra(select={'manufacture_cost'
 : 'price * .5'}).get(pk=2)
+        manufacture_cost = obj['manufacture_cost']
+        self.assertTrue(manufacture_cost == 11.545 or manufacture_cost == 
Decimal('11.545'))
+        del obj['manufacture_cost']
         self.assertEqual(obj, {
             'contact_id': 3,
             'id': 2,
             'isbn': u'067232959',
-            'manufacture_cost': 11.545,
             'mean_auth_age': 45.0,
             'name': u'Sams Teach Yourself Django in 24 Hours',
             'pages': 528,

-- 
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.

Reply via email to