changeset 6351:0db59cc2cd37

Enable testMultilinkOrdering check. Fix back_anydbm to pass. The testMultilinkOrdering was commented out with a "some day" comment. Well some day is today. Works on anydbm and sqlite. CI will tell me if I need to fix mysql and postgres.
author John Rouillard <rouilj@ieee.org>
date Sat, 27 Mar 2021 11:57:02 -0400
parents 6a69584d117e
children d3a5d0d95869
files roundup/backends/back_anydbm.py test/db_test_base.py
diffstat 2 files changed, 12 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/roundup/backends/back_anydbm.py	Sat Mar 27 11:55:19 2021 -0400
+++ b/roundup/backends/back_anydbm.py	Sat Mar 27 11:57:02 2021 -0400
@@ -1162,7 +1162,10 @@
 
         # return a dupe of the list so code doesn't get confused
         if isinstance(prop, hyperdb.Multilink):
-            return d[propname][:]
+            ids = d[propname][:]
+            print(ids)
+            ids.sort(key=lambda x: int(x))
+            return ids
 
         return d[propname]
 
--- a/test/db_test_base.py	Sat Mar 27 11:55:19 2021 -0400
+++ b/test/db_test_base.py	Sat Mar 27 11:57:02 2021 -0400
@@ -441,14 +441,14 @@
 
 
 # XXX one day, maybe...
-#    def testMultilinkOrdering(self):
-#        for i in range(10):
-#            self.db.user.create(username='foo%s'%i)
-#        i = self.db.issue.create(title="spam", nosy=['5','3','12','4'])
-#        self.db.commit()
-#        l = self.db.issue.get(i, "nosy")
-#        # all backends should return the Multilink numeric-id-sorted
-#        self.assertEqual(l, ['3', '4', '5', '12'])
+    def testMultilinkOrdering(self):
+        for i in range(10):
+            self.db.user.create(username='foo%s'%i)
+        i = self.db.issue.create(title="spam", nosy=['5','3','12','4'])
+        self.db.commit()
+        l = self.db.issue.get(i, "nosy")
+        # all backends should return the Multilink numeric-id-sorted
+        self.assertEqual(l, ['3', '4', '5', '12'])
 
     # Date
     def testDateChange(self):

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