diff test/test_db.py @ 543:22e0edf7da6e

lots of date/interval related changes: more relaxed date format for input
author Richard Jones <richard@users.sourceforge.net>
date Wed, 16 Jan 2002 07:02:57 +0000
parents dce4c75bef5a
children 5fd94347c6f2
line wrap: on
line diff
--- a/test/test_db.py	Wed Jan 16 04:54:27 2002 +0000
+++ b/test/test_db.py	Wed Jan 16 07:02:57 2002 +0000
@@ -15,13 +15,14 @@
 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 # 
-# $Id: test_db.py,v 1.13 2002-01-14 02:20:15 richard Exp $ 
+# $Id: test_db.py,v 1.14 2002-01-16 07:02:57 richard Exp $ 
 
 import unittest, os, shutil
 
 from roundup.hyperdb import String, Password, Link, Multilink, Date, \
     Interval, Class, DatabaseError
 from roundup.roundupdb import FileClass
+from roundup import date
 
 def setupSchema(db, create):
     status = Class(db, "status", name=String())
@@ -33,7 +34,7 @@
         status.create(name="resolved")
     Class(db, "user", username=String(), password=Password())
     Class(db, "issue", title=String(), status=Link("status"),
-        nosy=Multilink("user"))
+        nosy=Multilink("user"), deadline=Date(), foo=Interval())
     FileClass(db, "file", name=String(), type=String())
     db.commit()
 
@@ -76,9 +77,19 @@
         props = self.db.issue.getprops()
         keys = props.keys()
         keys.sort()
-        self.assertEqual(keys, ['fixer', 'id', 'nosy', 'status', 'title'])
+        self.assertEqual(keys, ['deadline', 'fixer', 'foo', 'id', 'nosy',
+            'status', 'title'])
         self.db.issue.set('5', status='2')
         self.db.issue.get('5', "status")
+
+        a = self.db.issue.get('5', "deadline")
+        self.db.issue.set('5', deadline=date.Date())
+        self.assertNotEqual(a, self.db.issue.get('5', "deadline"))
+
+        a = self.db.issue.get('5', "foo")
+        self.db.issue.set('5', foo=date.Interval('-1d'))
+        self.assertNotEqual(a, self.db.issue.get('5', "foo"))
+
         self.db.status.get('2', "name")
         self.db.issue.get('5', "title")
         self.db.issue.find(status = self.db.status.lookup("in-progress"))
@@ -274,6 +285,15 @@
 
 #
 # $Log: not supported by cvs2svn $
+# Revision 1.13  2002/01/14 02:20:15  richard
+#  . changed all config accesses so they access either the instance or the
+#    config attriubute on the db. This means that all config is obtained from
+#    instance_config instead of the mish-mash of classes. This will make
+#    switching to a ConfigParser setup easier too, I hope.
+#
+# At a minimum, this makes migration a _little_ easier (a lot easier in the
+# 0.5.0 switch, I hope!)
+#
 # Revision 1.12  2001/12/17 03:52:48  richard
 # Implemented file store rollback. As a bonus, the hyperdb is now capable of
 # storing more than one file per node - if a property name is supplied,

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