Commits

Anonymous committed e10ea47

refactored tests to use a comma-seperated filter style instead of a chained filter style

Comments (0)

Files changed (1)

     def test_chained_filter(self):
         # additionally tests count :)
         self.assertEquals(FieldsWithOptionsModel.objects.filter(
-                          floating_point__lt=5.3).filter(floating_point__gt=2.6).
+                          floating_point__lt=5.3, floating_point__gt=2.6).
                           count(), 0)
 
         # test across multiple columns. On app engine only one filter is allowed
         # to be an inequality filter
         self.assertEquals([(entity.floating_point, entity.integer) for entity in
                           FieldsWithOptionsModel.objects.filter(
-                          floating_point__lte=5.3).filter(integer=2).order_by(
+                          floating_point__lte=5.3, integer=2).order_by(
                           'floating_point')], [(2.6, 2), ])
 
         # test multiple filters including the primary_key field
         self.assertEquals([entity.email for entity in
                           FieldsWithOptionsModel.objects.filter(
-                          email__gte='rinnengan@sage.de').filter(integer=2).order_by(
+                          email__gte='rinnengan@sage.de', integer=2).order_by(
                           'email')], ['sharingan@uchias.com', ])
 
         # test in filter on primary key with another arbitrary filter
         self.assertEquals([entity.email for entity in
                           FieldsWithOptionsModel.objects.filter(
                           email__in=['rinnengan@sage.de',
-                          'sharingan@uchias.com']).filter(integer__gt=2).order_by(
+                          'sharingan@uchias.com'], integer__gt=2).order_by(
                           'integer')], ['rinnengan@sage.de', ])
 
         # Test exceptions
         # the first filter
         self.assertRaises(DatabaseError, lambda:
             FieldsWithOptionsModel.objects.filter(
-                email__gte='rinnengan@sage.de').filter(floating_point=5.3).order_by(
+                email__gte='rinnengan@sage.de', floating_point=5.3).order_by(
                 'floating_point')[0])
 
         # test exception if filtered across multiple columns with inequality filter
         self.assertRaises(DatabaseError, FieldsWithOptionsModel.objects.filter(
-                          floating_point__lte=5.3).filter(integer__gte=2).order_by(
+                          floating_point__lte=5.3, integer__gte=2).order_by(
                           'floating_point').get)
 
         # test exception if filtered across multiple columns with inequality filter
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.