Skip to content

Commit 328f7fc

Browse files
committed
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.
1 parent 7e6f466 commit 328f7fc

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

roundup/backends/back_anydbm.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1162,7 +1162,10 @@ def get(self, nodeid, propname, default=_marker, cache=1):
11621162

11631163
# return a dupe of the list so code doesn't get confused
11641164
if isinstance(prop, hyperdb.Multilink):
1165-
return d[propname][:]
1165+
ids = d[propname][:]
1166+
print(ids)
1167+
ids.sort(key=lambda x: int(x))
1168+
return ids
11661169

11671170
return d[propname]
11681171

test/db_test_base.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -441,14 +441,14 @@ def testMultilinkChangeIterable(self):
441441

442442

443443
# XXX one day, maybe...
444-
# def testMultilinkOrdering(self):
445-
# for i in range(10):
446-
# self.db.user.create(username='foo%s'%i)
447-
# i = self.db.issue.create(title="spam", nosy=['5','3','12','4'])
448-
# self.db.commit()
449-
# l = self.db.issue.get(i, "nosy")
450-
# # all backends should return the Multilink numeric-id-sorted
451-
# self.assertEqual(l, ['3', '4', '5', '12'])
444+
def testMultilinkOrdering(self):
445+
for i in range(10):
446+
self.db.user.create(username='foo%s'%i)
447+
i = self.db.issue.create(title="spam", nosy=['5','3','12','4'])
448+
self.db.commit()
449+
l = self.db.issue.get(i, "nosy")
450+
# all backends should return the Multilink numeric-id-sorted
451+
self.assertEqual(l, ['3', '4', '5', '12'])
452452

453453
# Date
454454
def testDateChange(self):

0 commit comments

Comments
 (0)