summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4def0a9)
raw | patch | inline | side by side (parent: 4def0a9)
author | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Thu, 10 Oct 2002 07:18:03 +0000 (07:18 +0000) | ||
committer | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Thu, 10 Oct 2002 07:18:03 +0000 (07:18 +0000) |
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@1334 57a73879-2fb5-44c3-a270-3262357dd7e2
roundup/date.py | patch | blob | history | |
test/test_db.py | patch | blob | history |
diff --git a/roundup/date.py b/roundup/date.py
index bdcc965510e879087263284fecbe897c7fe4130f..d279fdff17130c613501dd8d556350cdf9c95d54 100644 (file)
--- a/roundup/date.py
+++ b/roundup/date.py
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#
-# $Id: date.py,v 1.32 2002-09-23 12:09:29 richard Exp $
+# $Id: date.py,v 1.33 2002-10-10 07:18:02 richard Exp $
__doc__ = """
Date, time and time interval handling.
self.minute, self.second)
def serialise(self):
- return '%s%4d%02d%02d%02d%02d%02d'%(self.sign, self.year, self.month,
+ sign = self.sign > 0 and '+' or '-'
+ return '%s%04d%02d%02d%02d%02d%02d'%(sign, self.year, self.month,
self.day, self.hour, self.minute, self.second)
diff --git a/test/test_db.py b/test/test_db.py
index 46ecab9238ed0faeb8695df3580c8907c8802f5a..86d3b4f3d5bc211e832cecd15d904f7b0f53f8d6 100644 (file)
--- a/test/test_db.py
+++ b/test/test_db.py
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#
-# $Id: test_db.py,v 1.59 2002-10-08 07:28:34 richard Exp $
+# $Id: test_db.py,v 1.60 2002-10-10 07:18:03 richard Exp $
import unittest, os, shutil, time
self.assertEqual(self.db.issue.get('1', "deadline"), None)
def testIntervalChange(self):
- self.db.issue.create(title="spam", status='1')
- a = self.db.issue.get('1', "foo")
- self.db.issue.set('1', foo=date.Interval('-1d'))
- self.assertNotEqual(self.db.issue.get('1', "foo"), a)
- self.db.issue.set('1', foo=None)
- self.assertEqual(self.db.issue.get('1', "foo"), None)
+ nid = self.db.issue.create(title="spam", status='1')
+ self.db.commit()
+ a = self.db.issue.get(nid, "foo")
+ i = date.Interval('-1d')
+ self.db.issue.set(nid, foo=i)
+ self.db.commit()
+ self.assertNotEqual(self.db.issue.get(nid, "foo"), a)
+ self.assertEqual(i, self.db.issue.get(nid, "foo"))
+ j = date.Interval('1y')
+ self.db.issue.set(nid, foo=j)
+ self.db.commit()
+ self.assertNotEqual(self.db.issue.get(nid, "foo"), i)
+ self.assertEqual(j, self.db.issue.get(nid, "foo"))
+ self.db.issue.set(nid, foo=None)
+ self.db.commit()
+ self.assertEqual(self.db.issue.get(nid, "foo"), None)
def testBooleanChange(self):
userid = self.db.user.create(username='foo', assignable=1)