comparison test/db_test_base.py @ 3746:5cde43526788 1.3.0

*** empty log message ***
author Richard Jones <richard@users.sourceforge.net>
date Thu, 09 Nov 2006 05:44:51 +0000
parents e754cc14e76a
children 44603dd791b7
comparison
equal deleted inserted replaced
3745:20e9831fc58a 3746:5cde43526788
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.79 2006-11-09 03:08:22 richard Exp $ 18 # $Id: db_test_base.py,v 1.80 2006-11-09 05:44:51 richard Exp $
19 19
20 import unittest, os, shutil, errno, imp, sys, time, pprint, sets 20 import unittest, os, shutil, errno, imp, sys, time, pprint, sets
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
1043 def testFilteringMany(self): 1043 def testFilteringMany(self):
1044 ae, filt = self.filteringSetup() 1044 ae, filt = self.filteringSetup()
1045 ae(filt(None, {'nosy': '2', 'status': '1'}, ('+','id'), (None,None)), 1045 ae(filt(None, {'nosy': '2', 'status': '1'}, ('+','id'), (None,None)),
1046 ['3']) 1046 ['3'])
1047 1047
1048 def testFilteringRange(self): 1048 def testFilteringRangeBasic(self):
1049 ae, filt = self.filteringSetup() 1049 ae, filt = self.filteringSetup()
1050 # Date ranges
1051 ae(filt(None, {'deadline': 'from 2003-02-10 to 2003-02-23'}), ['1','3']) 1050 ae(filt(None, {'deadline': 'from 2003-02-10 to 2003-02-23'}), ['1','3'])
1052 ae(filt(None, {'deadline': '2003-02-10; 2003-02-23'}), ['1','3']) 1051 ae(filt(None, {'deadline': '2003-02-10; 2003-02-23'}), ['1','3'])
1053 ae(filt(None, {'deadline': '; 2003-02-16'}), ['2']) 1052 ae(filt(None, {'deadline': '; 2003-02-16'}), ['2'])
1054 # Lets assume people won't invent a time machine, otherwise this test 1053
1055 # may fail :) 1054 def testFilteringRangeTwoSyntaxes(self):
1055 ae, filt = self.filteringSetup()
1056 ae(filt(None, {'deadline': 'from 2003-02-16'}), ['1', '3', '4']) 1056 ae(filt(None, {'deadline': 'from 2003-02-16'}), ['1', '3', '4'])
1057 ae(filt(None, {'deadline': '2003-02-16;'}), ['1', '3', '4']) 1057 ae(filt(None, {'deadline': '2003-02-16;'}), ['1', '3', '4'])
1058 ae(filt(None, {'deadline': '2003-02-16;'}), ['1', '3', '4']) 1058
1059 # year and month granularity 1059 def testFilteringRangeYearMonthDay(self):
1060 ae, filt = self.filteringSetup()
1060 ae(filt(None, {'deadline': '2002'}), []) 1061 ae(filt(None, {'deadline': '2002'}), [])
1061 ae(filt(None, {'deadline': '2003'}), ['1', '2', '3']) 1062 ae(filt(None, {'deadline': '2003'}), ['1', '2', '3'])
1062 ae(filt(None, {'deadline': '2004'}), ['4']) 1063 ae(filt(None, {'deadline': '2004'}), ['4'])
1063 ae(filt(None, {'deadline': '2003-02'}), ['1', '3']) 1064 ae(filt(None, {'deadline': '2003-02'}), ['1', '3'])
1064 ae(filt(None, {'deadline': '2003-03'}), []) 1065 ae(filt(None, {'deadline': '2003-03'}), [])
1065 ae(filt(None, {'deadline': '2003-02-16'}), ['1']) 1066 ae(filt(None, {'deadline': '2003-02-16'}), ['1'])
1066 ae(filt(None, {'deadline': '2003-02-17'}), []) 1067 ae(filt(None, {'deadline': '2003-02-17'}), [])
1067 # Interval ranges 1068
1069 def testFilteringRangeInterval(self):
1070 ae, filt = self.filteringSetup()
1068 ae(filt(None, {'foo': 'from 0:50 to 2:00'}), ['1']) 1071 ae(filt(None, {'foo': 'from 0:50 to 2:00'}), ['1'])
1069 ae(filt(None, {'foo': 'from 0:50 to 1d 2:00'}), ['1', '2']) 1072 ae(filt(None, {'foo': 'from 0:50 to 1d 2:00'}), ['1', '2'])
1070 ae(filt(None, {'foo': 'from 5:50'}), ['2']) 1073 ae(filt(None, {'foo': 'from 5:50'}), ['2'])
1071 ae(filt(None, {'foo': 'to 0:05'}), []) 1074 ae(filt(None, {'foo': 'to 0:05'}), [])
1072 1075
1073 # further 1076 def testFilteringRangeGeekInterval(self):
1077 ae, filt = self.filteringSetup()
1074 for issue in ( 1078 for issue in (
1075 { 'deadline': date.Date('. -2d')}, 1079 { 'deadline': date.Date('. -2d')},
1076 { 'deadline': date.Date('. -1d')}, 1080 { 'deadline': date.Date('. -1d')},
1077 { 'deadline': date.Date('. -8d')}, 1081 { 'deadline': date.Date('. -8d')},
1078 ): 1082 ):

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