diff test/db_test_base.py @ 3685:4d9adb8bc3b1

Null-value sorting fixes: - Fixed sorting of NULL values for the PostgreSQL backend. Generic implementation of additional sort-key for NULL values, can be reused by other (future) rdbms backends. - Added a test for NULL value sorting and removed an override for the Interval test for the PostgreSQL backend which had a special case for NULL values
author Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
date Wed, 23 Aug 2006 12:57:10 +0000
parents bffa231ec3bc
children 8e52157e2073
line wrap: on
line diff
--- a/test/db_test_base.py	Tue Aug 22 19:33:02 2006 +0000
+++ b/test/db_test_base.py	Wed Aug 23 12:57:10 2006 +0000
@@ -15,7 +15,7 @@
 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 #
-# $Id: db_test_base.py,v 1.76 2006-08-22 19:33:02 schlatterbeck Exp $
+# $Id: db_test_base.py,v 1.77 2006-08-23 12:57:10 schlatterbeck Exp $
 
 import unittest, os, shutil, errno, imp, sys, time, pprint, sets
 
@@ -1216,8 +1216,8 @@
         ae, filt = self.filteringSetupTransitiveSearch()
         ufilt = self.db.user.filter
         # Need to make ceo his own (and first two users') supervisor,
-        # otherwise sorting for postgreSQL will fail: postgreSQL seems
-        # to sort NULLs last.
+        # otherwise we will depend on sorting order of NULL values.
+        # Leave that to a separate test.
         self.db.user.set('1', supervisor = '3')
         self.db.user.set('2', supervisor = '3')
         self.db.user.set('3', supervisor = '3')
@@ -1253,6 +1253,27 @@
             ('-','assignedto.supervisor'), ('+','assignedto'), ('+','status')]),
             ['4', '5', '7', '6', '8', '1', '2', '3'])
 
+    def testFilteringTransitiveLinkSortNull(self):
+        """Check sorting of NULL values"""
+        ae, filt = self.filteringSetupTransitiveSearch()
+        ufilt = self.db.user.filter
+        ae(ufilt(None, {}, [('+','supervisor.supervisor.supervisor'),
+            ('+','supervisor.supervisor'), ('+','supervisor'),
+            ('+','username')]),
+            ['1', '3', '2', '4', '5', '6', '7', '8', '9', '10'])
+        ae(ufilt(None, {}, [('+','supervisor.supervisor.supervisor'),
+            ('-','supervisor.supervisor'), ('-','supervisor'),
+            ('+','username')]),
+            ['8', '9', '10', '6', '7', '4', '5', '1', '3', '2'])
+        ae(filt(None, {}, [('+','assignedto.supervisor.supervisor.supervisor'),
+            ('+','assignedto.supervisor.supervisor'),
+            ('+','assignedto.supervisor'), ('+','assignedto')]),
+            ['1', '2', '3', '4', '5', '6', '7', '8'])
+        ae(filt(None, {}, [('+','assignedto.supervisor.supervisor.supervisor'),
+            ('+','assignedto.supervisor.supervisor'),
+            ('-','assignedto.supervisor'), ('+','assignedto')]),
+            ['4', '5', '6', '7', '8', '1', '2', '3'])
+
     def testFilteringTransitiveLinkIssue(self):
         ae, filt = self.filteringSetupTransitiveSearch()
         ae(filt(None, {'assignedto.supervisor.username': 'grouplead1'},

Roundup Issue Tracker: http://roundup-tracker.org/