Mercurial > p > roundup > code
comparison test/db_test_base.py @ 2419:422b684313d5 maint-0.7
merge from HEAD
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Wed, 09 Jun 2004 06:37:22 +0000 |
| parents | 1cc51a44ce39 |
| children | 32c813e7f03f |
comparison
equal
deleted
inserted
replaced
| 2417:fe722c32ce0c | 2419:422b684313d5 |
|---|---|
| 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: db_test_base.py,v 1.27.2.2 2004-06-08 05:35:44 richard Exp $ | 18 # $Id: db_test_base.py,v 1.27.2.3 2004-06-09 06:37:22 richard Exp $ |
| 19 | 19 |
| 20 import unittest, os, shutil, errno, imp, sys, time, pprint | 20 import unittest, os, shutil, errno, imp, sys, time, pprint |
| 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 |
| 811 self.db.issue.retire(ids[0]) | 811 self.db.issue.retire(ids[0]) |
| 812 self.assertEqual(len(self.db.issue.stringFind(title='spam')), 1) | 812 self.assertEqual(len(self.db.issue.stringFind(title='spam')), 1) |
| 813 | 813 |
| 814 def filteringSetup(self): | 814 def filteringSetup(self): |
| 815 for user in ( | 815 for user in ( |
| 816 {'username': 'bleep'}, | 816 {'username': 'bleep', 'age': 1}, |
| 817 {'username': 'blop'}, | 817 {'username': 'blop', 'age': 1.5}, |
| 818 {'username': 'blorp'}): | 818 {'username': 'blorp', 'age': 2}): |
| 819 self.db.user.create(**user) | 819 self.db.user.create(**user) |
| 820 iss = self.db.issue | 820 iss = self.db.issue |
| 821 for issue in ( | 821 for issue in ( |
| 822 {'title': 'issue one', 'status': '2', 'assignedto': '1', | 822 {'title': 'issue one', 'status': '2', 'assignedto': '1', |
| 823 'foo': date.Interval('1:10'), 'priority': '1', | 823 'foo': date.Interval('1:10'), 'priority': '1', |
| 837 def testFilteringID(self): | 837 def testFilteringID(self): |
| 838 ae, filt = self.filteringSetup() | 838 ae, filt = self.filteringSetup() |
| 839 ae(filt(None, {'id': '1'}, ('+','id'), (None,None)), ['1']) | 839 ae(filt(None, {'id': '1'}, ('+','id'), (None,None)), ['1']) |
| 840 ae(filt(None, {'id': '2'}, ('+','id'), (None,None)), ['2']) | 840 ae(filt(None, {'id': '2'}, ('+','id'), (None,None)), ['2']) |
| 841 ae(filt(None, {'id': '10'}, ('+','id'), (None,None)), []) | 841 ae(filt(None, {'id': '10'}, ('+','id'), (None,None)), []) |
| 842 | |
| 843 def testFilteringNumber(self): | |
| 844 self.filteringSetup() | |
| 845 ae, filt = self.assertEqual, self.db.user.filter | |
| 846 ae(filt(None, {'age': '1'}, ('+','id'), (None,None)), ['3']) | |
| 847 ae(filt(None, {'age': '1.5'}, ('+','id'), (None,None)), ['4']) | |
| 848 ae(filt(None, {'age': '2'}, ('+','id'), (None,None)), ['5']) | |
| 842 | 849 |
| 843 def testFilteringString(self): | 850 def testFilteringString(self): |
| 844 ae, filt = self.filteringSetup() | 851 ae, filt = self.filteringSetup() |
| 845 ae(filt(None, {'title': ['one']}, ('+','id'), (None,None)), ['1']) | 852 ae(filt(None, {'title': ['one']}, ('+','id'), (None,None)), ['1']) |
| 846 ae(filt(None, {'title': ['issue']}, ('+','id'), (None,None)), | 853 ae(filt(None, {'title': ['issue']}, ('+','id'), (None,None)), |
