Mercurial > p > roundup > code
comparison test/db_test_base.py @ 3586:f47bddab5a49
date spec wasn't allowing week intervals
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Fri, 03 Mar 2006 02:02:50 +0000 |
| parents | 5e70726a86dd |
| children | 7b25567f0f54 |
comparison
equal
deleted
inserted
replaced
| 3585:438adf66eb1a | 3586:f47bddab5a49 |
|---|---|
| 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.67 2006-02-09 23:53:11 richard Exp $ | 18 # $Id: db_test_base.py,v 1.68 2006-03-03 02:02:50 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 |
| 994 ae(filt(None, {'deadline': '; 2003-02-16'}), ['2']) | 994 ae(filt(None, {'deadline': '; 2003-02-16'}), ['2']) |
| 995 # Lets assume people won't invent a time machine, otherwise this test | 995 # Lets assume people won't invent a time machine, otherwise this test |
| 996 # may fail :) | 996 # may fail :) |
| 997 ae(filt(None, {'deadline': 'from 2003-02-16'}), ['1', '3', '4']) | 997 ae(filt(None, {'deadline': 'from 2003-02-16'}), ['1', '3', '4']) |
| 998 ae(filt(None, {'deadline': '2003-02-16;'}), ['1', '3', '4']) | 998 ae(filt(None, {'deadline': '2003-02-16;'}), ['1', '3', '4']) |
| 999 ae(filt(None, {'deadline': '2003-02-16;'}), ['1', '3', '4']) | |
| 999 # year and month granularity | 1000 # year and month granularity |
| 1000 ae(filt(None, {'deadline': '2002'}), []) | 1001 ae(filt(None, {'deadline': '2002'}), []) |
| 1001 ae(filt(None, {'deadline': '2003'}), ['1', '2', '3']) | 1002 ae(filt(None, {'deadline': '2003'}), ['1', '2', '3']) |
| 1002 ae(filt(None, {'deadline': '2004'}), ['4']) | 1003 ae(filt(None, {'deadline': '2004'}), ['4']) |
| 1003 ae(filt(None, {'deadline': '2003-02'}), ['1', '3']) | 1004 ae(filt(None, {'deadline': '2003-02'}), ['1', '3']) |
| 1007 # Interval ranges | 1008 # Interval ranges |
| 1008 ae(filt(None, {'foo': 'from 0:50 to 2:00'}), ['1']) | 1009 ae(filt(None, {'foo': 'from 0:50 to 2:00'}), ['1']) |
| 1009 ae(filt(None, {'foo': 'from 0:50 to 1d 2:00'}), ['1', '2']) | 1010 ae(filt(None, {'foo': 'from 0:50 to 1d 2:00'}), ['1', '2']) |
| 1010 ae(filt(None, {'foo': 'from 5:50'}), ['2']) | 1011 ae(filt(None, {'foo': 'from 5:50'}), ['2']) |
| 1011 ae(filt(None, {'foo': 'to 0:05'}), []) | 1012 ae(filt(None, {'foo': 'to 0:05'}), []) |
| 1013 | |
| 1014 # further | |
| 1015 for issue in ( | |
| 1016 { 'deadline': date.Date('. -2d')}, | |
| 1017 { 'deadline': date.Date('. -1d')}, | |
| 1018 { 'deadline': date.Date('. -8d')}, | |
| 1019 ): | |
| 1020 self.db.issue.create(**issue) | |
| 1021 ae(filt(None, {'deadline': '-2d;'}), ['5', '6']) | |
| 1022 ae(filt(None, {'deadline': '-1d;'}), ['6']) | |
| 1023 ae(filt(None, {'deadline': '-1w;'}), ['5', '6']) | |
| 1012 | 1024 |
| 1013 def testFilteringIntervalSort(self): | 1025 def testFilteringIntervalSort(self): |
| 1014 # 1: '1:10' | 1026 # 1: '1:10' |
| 1015 # 2: '1d' | 1027 # 2: '1d' |
| 1016 # 3: None | 1028 # 3: None |
