comparison test/test_db.py @ 1599:cc96bf971b33

extended date syntax to make range searches even more useful
author Andrey Lebedev <kedder@users.sourceforge.net>
date Tue, 22 Apr 2003 20:53:55 +0000
parents b3263567b8c6
children 8a908bbad1ef
comparison
equal deleted inserted replaced
1598:b3263567b8c6 1599:cc96bf971b33
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.87 2003-04-21 22:38:48 richard Exp $ 18 # $Id: test_db.py,v 1.88 2003-04-22 20:53:55 kedder 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
701 # Lets assume people won't invent a time machine, otherwise this test 701 # Lets assume people won't invent a time machine, otherwise this test
702 # may fail :) 702 # may fail :)
703 ae(filt(None, {'deadline': 'from 2003-02-16'}), ['2', '3', '4']) 703 ae(filt(None, {'deadline': 'from 2003-02-16'}), ['2', '3', '4'])
704 ae(filt(None, {'deadline': '2003-02-16;'}), ['2', '3', '4']) 704 ae(filt(None, {'deadline': '2003-02-16;'}), ['2', '3', '4'])
705 # year and month granularity 705 # year and month granularity
706 ae(filt(None, {'deadline': '2002'}), [])
706 ae(filt(None, {'deadline': '2003'}), ['1', '2', '3']) 707 ae(filt(None, {'deadline': '2003'}), ['1', '2', '3'])
707 ae(filt(None, {'deadline': '2004'}), ['4']) 708 ae(filt(None, {'deadline': '2004'}), ['4'])
708 ae(filt(None, {'deadline': '2003-02'}), ['2', '3']) 709 ae(filt(None, {'deadline': '2003-02'}), ['2', '3'])
709 ae(filt(None, {'deadline': '2003-03'}), []) 710 ae(filt(None, {'deadline': '2003-03'}), [])
710 ae(filt(None, {'deadline': '2003-02-16'}), ['2']) 711 ae(filt(None, {'deadline': '2003-02-16'}), ['2'])
711 ae(filt(None, {'deadline': '2003-02-17'}), []) 712 ae(filt(None, {'deadline': '2003-02-17'}), [])
712 # Interval ranges 713 # Interval ranges
713 ae(filt(None, {'foo': 'from 0:50 to 2:00'}), ['1']) 714 ae(filt(None, {'foo': 'from 0:50 to 2:00'}), ['1'])
714 ae(filt(None, {'foo': 'from 0:50 to 1d 2:00'}), ['1', '2']) 715 ae(filt(None, {'foo': 'from 0:50 to 1d 2:00'}), ['1', '2'])
715 ae(filt(None, {'foo': 'from 5:50'}), ['2']) 716 ae(filt(None, {'foo': 'from 5:50'}), ['2'])
716 ae(filt(None, {'foo': 'to 0:50'}), []) 717 ae(filt(None, {'foo': 'to 0:05'}), [])
717 718
718 def testFilteringIntervalSort(self): 719 def testFilteringIntervalSort(self):
719 ae, filt = self.filteringSetup() 720 ae, filt = self.filteringSetup()
720 # ascending should sort None, 1:10, 1d 721 # ascending should sort None, 1:10, 1d
721 ae(filt(None, {}, ('+','foo'), (None,None)), ['3', '4', '1', '2']) 722 ae(filt(None, {}, ('+','foo'), (None,None)), ['3', '4', '1', '2'])

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