comparison test/db_test_base.py @ 4886:a116de39e38c

Fix sort-representation for RDBMS backends ...when sorting on Multilinks in python This fixes issue2550834 "postgres gets error with Date attribute in groupby sort".
author Ralf Schlatterbeck <rsc@runtux.com>
date Fri, 04 Apr 2014 08:09:30 +0200
parents e56047711df2
children 63c79c0992ae
comparison
equal deleted inserted replaced
4885:e56047711df2 4886:a116de39e38c
440 ae(filt(None, {}, ('+','id'), ('+', 'deadline')), 440 ae(filt(None, {}, ('+','id'), ('+', 'deadline')),
441 ['5', '2', '1', '3', '4']) 441 ['5', '2', '1', '3', '4'])
442 ae(filt(None, {}, ('-','id'), ('-', 'deadline')), 442 ae(filt(None, {}, ('-','id'), ('-', 'deadline')),
443 ['4', '3', '1', '2', '5']) 443 ['4', '3', '1', '2', '5'])
444 444
445 def testDateSortMultilink(self):
446 d1 = date.Date('.')
447 ae, filter, filter_iter = self.filteringSetup()
448 nid = self.db.issue.create(title="nodeadline", status='1')
449 self.db.commit()
450 ae(sorted(self.db.issue.get('1','nosy')), [])
451 ae(sorted(self.db.issue.get('2','nosy')), [])
452 ae(sorted(self.db.issue.get('3','nosy')), ['1','2'])
453 ae(sorted(self.db.issue.get('4','nosy')), ['1','2','3'])
454 ae(sorted(self.db.issue.get('5','nosy')), [])
455 ae(self.db.user.get('1','username'), 'admin')
456 ae(self.db.user.get('2','username'), 'fred')
457 ae(self.db.user.get('3','username'), 'bleep')
458 # filter_iter currently doesn't work for Multilink sort
459 # so testing only filter
460 ae(filter(None, {}, ('+', 'id'), ('+','nosy')),
461 ['1', '2', '5', '4', '3'])
462 ae(filter(None, {}, ('+','deadline'), ('+', 'nosy')),
463 ['5', '2', '1', '4', '3'])
464 ae(filter(None, {}, ('+','nosy'), ('+', 'deadline')),
465 ['5', '2', '1', '3', '4'])
445 466
446 # Interval 467 # Interval
447 def testIntervalChange(self): 468 def testIntervalChange(self):
448 self.assertRaises(TypeError, self.db.issue.create, 469 self.assertRaises(TypeError, self.db.issue.create,
449 title='spam', foo=1) 470 title='spam', foo=1)

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