Mercurial > p > roundup > code
comparison test/db_test_base.py @ 3955:de6326aee6d0
Final fix for date range searching stuff: fix the test :)
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Sun, 23 Dec 2007 01:52:07 +0000 |
| parents | 78dc9b275aeb |
| children | 3230f9c88086 |
comparison
equal
deleted
inserted
replaced
| 3954:3d5a0a949107 | 3955:de6326aee6d0 |
|---|---|
| 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.94 2007-12-21 11:21:08 richard Exp $ | 18 # $Id: db_test_base.py,v 1.95 2007-12-23 01:52:07 richard Exp $ |
| 19 | 19 |
| 20 import unittest, os, shutil, errno, imp, sys, time, pprint, sets, base64, os.path | 20 import unittest, os, shutil, errno, imp, sys, time, pprint, sets, base64, os.path |
| 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 |
| 1191 ae(filt(None, {'deadline': '2003-02-16'}), ['1']) | 1191 ae(filt(None, {'deadline': '2003-02-16'}), ['1']) |
| 1192 ae(filt(None, {'deadline': '2003-02-17'}), []) | 1192 ae(filt(None, {'deadline': '2003-02-17'}), []) |
| 1193 | 1193 |
| 1194 def testFilteringRangeMonths(self): | 1194 def testFilteringRangeMonths(self): |
| 1195 ae, filt = self.filteringSetup() | 1195 ae, filt = self.filteringSetup() |
| 1196 for month in range(1, 5): #13): | 1196 for month in range(1, 13): |
| 1197 print 'MONTH', month | |
| 1198 for n in range(1, month+1): | 1197 for n in range(1, month+1): |
| 1199 i = self.db.issue.create(title='%d.%d'%(month, n), | 1198 i = self.db.issue.create(title='%d.%d'%(month, n), |
| 1200 deadline=date.Date('2004-%02d-%02d.00:00'%(month, n))) | 1199 deadline=date.Date('2001-%02d-%02d.00:00'%(month, n))) |
| 1201 print 'CREATE', i, self.db.issue.get(i, 'deadline') | |
| 1202 self.db.commit() | 1200 self.db.commit() |
| 1203 | 1201 |
| 1204 for month in range(1, 13): | 1202 for month in range(1, 13): |
| 1205 r = filt(None, dict(deadline='2004-%02d'%month)) | 1203 r = filt(None, dict(deadline='2001-%02d'%month)) |
| 1206 assert len(r) == month, 'month %d != length %d'%(month, len(r)) | 1204 assert len(r) == month, 'month %d != length %d'%(month, len(r)) |
| 1207 | 1205 |
| 1208 def testFilteringRangeInterval(self): | 1206 def testFilteringRangeInterval(self): |
| 1209 ae, filt = self.filteringSetup() | 1207 ae, filt = self.filteringSetup() |
| 1210 ae(filt(None, {'foo': 'from 0:50 to 2:00'}), ['1']) | 1208 ae(filt(None, {'foo': 'from 0:50 to 2:00'}), ['1']) |
