Mailing List Archive

python/nondist/sandbox/datetime test_both.py,1.6,1.7 test_cdatetime.py,1.9,1.10 test_datetime.py,1.49,1.50
Update of /cvsroot/python/python/nondist/sandbox/datetime
In directory sc8-pr-cvs1:/tmp/cvs-serv29160

Modified Files:
test_both.py test_cdatetime.py test_datetime.py
Log Message:
Moving more datetime tests into test_both.


Index: test_both.py
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/datetime/test_both.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** test_both.py 26 Nov 2002 17:26:17 -0000 1.6
--- test_both.py 26 Nov 2002 17:31:20 -0000 1.7
***************
*** 373,376 ****
--- 373,403 ----
self.assertEqual(dt.microsecond, 0)

+ def test_basic_attributes_nonzero(self):
+ # Make sure all attributes are non-zero so bugs in
+ # bit-shifting access show up.
+ dt = self.theclass(2002, 3, 1, 12, 59, 59, 8000)
+ self.assertEqual(dt.year, 2002)
+ self.assertEqual(dt.month, 3)
+ self.assertEqual(dt.day, 1)
+ self.assertEqual(dt.hour, 12)
+ self.assertEqual(dt.minute, 59)
+ self.assertEqual(dt.second, 59)
+ self.assertEqual(dt.microsecond, 8000)
+
+ def test_roundtrip(self):
+ for dt in (self.theclass(1, 2, 3, 4, 5, 6, 7),
+ self.theclass.now()):
+ # Verify dt -> string -> datetime identity.
+ s = 'datetime.' + repr(dt)
+ dt2 = eval(s)
+ self.assertEqual(dt, dt2)
+
+ # Verify identity via reconstructing from pieces.
+ dt2 = self.theclass(dt.year, dt.month, dt.day,
+ dt.hour, dt.minute, dt.second,
+ dt.microsecond)
+ self.assertEqual(dt, dt2)
+
+

def test_suite():

Index: test_cdatetime.py
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/datetime/test_cdatetime.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** test_cdatetime.py 26 Nov 2002 17:26:18 -0000 1.9
--- test_cdatetime.py 26 Nov 2002 17:31:20 -0000 1.10
***************
*** 31,60 ****
theclass = datetime

- def test_basic_attributes_nonzero(self):
- # Make sure all attributes are non-zero so bugs in
- # bit-shifting access show up.
- dt = self.theclass(2002, 3, 1, 12, 59, 59, 8000)
- self.assertEqual(dt.year, 2002)
- self.assertEqual(dt.month, 3)
- self.assertEqual(dt.day, 1)
- self.assertEqual(dt.hour, 12)
- self.assertEqual(dt.minute, 59)
- self.assertEqual(dt.second, 59)
- self.assertEqual(dt.microsecond, 8000)
-
- def test_roundtrip(self):
- for dt in (self.theclass(1, 2, 3, 4, 5, 6, 7),
- self.theclass.now()):
- # Verify dt -> string -> datetime identity.
- s = repr(dt)
- dt2 = eval(s)
- self.assertEqual(dt, dt2)
-
- # Verify identity via reconstructing from pieces.
- dt2 = self.theclass(dt.year, dt.month, dt.day,
- dt.hour, dt.minute, dt.second,
- dt.microsecond)
- self.assertEqual(dt, dt2)
-
def test_isocalendar(self):
# Check examples from
--- 31,34 ----

Index: test_datetime.py
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/datetime/test_datetime.py,v
retrieving revision 1.49
retrieving revision 1.50
diff -C2 -d -r1.49 -r1.50
*** test_datetime.py 26 Nov 2002 17:26:18 -0000 1.49
--- test_datetime.py 26 Nov 2002 17:31:21 -0000 1.50
***************
*** 215,244 ****
theclass = datetime

- def test_basic_attributes_nonzero(self):
- # Make sure all attributes are non-zero so bugs in
- # bit-shifting access show up.
- dt = self.theclass(2002, 3, 1, 12, 59, 59, 8000)
- self.assertEqual(dt.year, 2002)
- self.assertEqual(dt.month, 3)
- self.assertEqual(dt.day, 1)
- self.assertEqual(dt.hour, 12)
- self.assertEqual(dt.minute, 59)
- self.assertEqual(dt.second, 59)
- self.assertEqual(dt.microsecond, 8000)
-
- def test_roundtrip(self):
- for dt in (self.theclass(1, 2, 3, 4, 5, 6, 7),
- self.theclass.now()):
- # Verify dt -> string -> datetime identity.
- s = repr(dt)
- dt2 = eval(s)
- self.assertEqual(dt, dt2)
-
- # Verify identity via reconstructing from pieces.
- dt2 = self.theclass(dt.year, dt.month, dt.day,
- dt.hour, dt.minute, dt.second,
- dt.microsecond)
- self.assertEqual(dt, dt2)
-
def test_tz_independent_comparing(self):
dt1 = self.theclass(2002, 3, 1, 9, 0, 0)
--- 215,218 ----