Mercurial > p > roundup > code
comparison test/test_db.py @ 1505:c101d2ff5a20
fix to [SF#691071], really this time
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Mon, 10 Mar 2003 00:22:52 +0000 |
| parents | 2fc7d4a8c9e7 |
| children | 8b698780bb7d |
comparison
equal
deleted
inserted
replaced
| 1503:94ec56691f07 | 1505:c101d2ff5a20 |
|---|---|
| 13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | 13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
| 14 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" | 14 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" |
| 15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, | 15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, |
| 16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. | 16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
| 17 # | 17 # |
| 18 # $Id: test_db.py,v 1.74 2003-03-06 06:03:51 richard Exp $ | 18 # $Id: test_db.py,v 1.75 2003-03-10 00:22:21 richard Exp $ |
| 19 | 19 |
| 20 import unittest, os, shutil, time | 20 import unittest, os, shutil, time |
| 21 | 21 |
| 22 from roundup.hyperdb import String, Password, Link, Multilink, Date, \ | 22 from roundup.hyperdb import String, Password, Link, Multilink, Date, \ |
| 23 Interval, DatabaseError, Boolean, Number, Node | 23 Interval, DatabaseError, Boolean, Number, Node |
| 630 {'username': 'blop'}, | 630 {'username': 'blop'}, |
| 631 {'username': 'blorp'}): | 631 {'username': 'blorp'}): |
| 632 self.db.user.create(**user) | 632 self.db.user.create(**user) |
| 633 iss = self.db.issue | 633 iss = self.db.issue |
| 634 for issue in ( | 634 for issue in ( |
| 635 {'title': 'issue one', 'status': '2'}, | 635 {'title': 'issue one', 'status': '2', |
| 636 {'title': 'issue two', 'status': '1'}, | 636 'foo': date.Interval('1:10')}, |
| 637 {'title': 'issue three', 'status': '1', 'nosy': ['1','2']}): | 637 {'title': 'issue two', 'status': '1', |
| 638 'foo': date.Interval('1d')}, | |
| 639 {'title': 'issue three', 'status': '1', | |
| 640 'nosy': ['1','2']}): | |
| 638 self.db.issue.create(**issue) | 641 self.db.issue.create(**issue) |
| 639 self.db.commit() | 642 self.db.commit() |
| 640 return self.assertEqual, self.db.issue.filter | 643 return self.assertEqual, self.db.issue.filter |
| 641 | 644 |
| 642 def testFilteringID(self): | 645 def testFilteringID(self): |
| 660 def testFilteringMany(self): | 663 def testFilteringMany(self): |
| 661 ae, filt = self.filteringSetup() | 664 ae, filt = self.filteringSetup() |
| 662 ae(filt(None, {'nosy': '2', 'status': '1'}, ('+','id'), (None,None)), | 665 ae(filt(None, {'nosy': '2', 'status': '1'}, ('+','id'), (None,None)), |
| 663 ['3']) | 666 ['3']) |
| 664 | 667 |
| 665 | 668 def testFilteringIntervalSort(self): |
| 666 # TODO test auditors and reactors | 669 ae, filt = self.filteringSetup() |
| 670 # ascending should sort None, 1:10, 1d | |
| 671 ae(filt(None, {}, ('+','foo'), (None,None)), ['3', '1', '2']) | |
| 672 # descending should sort 1d, 1:10, None | |
| 673 ae(filt(None, {}, ('-','foo'), (None,None)), ['2', '1', '3']) | |
| 674 | |
| 675 | |
| 676 # XXX add sorting tests for other types | |
| 677 # XXX test auditors and reactors | |
| 667 | 678 |
| 668 class anydbmReadOnlyDBTestCase(MyTestCase): | 679 class anydbmReadOnlyDBTestCase(MyTestCase): |
| 669 def setUp(self): | 680 def setUp(self): |
| 670 from roundup.backends import anydbm | 681 from roundup.backends import anydbm |
| 671 # remove previous test, ignore errors | 682 # remove previous test, ignore errors |
