]> granicus.if.org Git - python/commitdiff
Added new an better structseq representation. E.g. repr(time.gmtime(0)) now returns...
authorChristian Heimes <christian@cheimes.de>
Mon, 14 Jan 2008 03:33:52 +0000 (03:33 +0000)
committerChristian Heimes <christian@cheimes.de>
Mon, 14 Jan 2008 03:33:52 +0000 (03:33 +0000)
Lib/test/test_structseq.py
Misc/NEWS

index 1af0583804d79a80aa4a573b954f5168faec4514..83c7ccf57d14e23df56d9033173f849f7e2d478f 100644 (file)
@@ -28,7 +28,11 @@ class StructSeqTest(unittest.TestCase):
 
     def test_repr(self):
         t = time.gmtime()
-        repr(t)
+        self.assert_(repr(t))
+        t = time.gmtime(0)
+        self.assertEqual(repr(t),
+            "time.struct_time(tm_year=1970, tm_mon=1, tm_mday=1, tm_hour=0, "
+            "tm_min=0, tm_sec=0, tm_wday=3, tm_yday=1, tm_isdst=0)")
 
     def test_concat(self):
         t1 = time.gmtime()
index ca2d996c2ef8c990640f9ee016abe167e48559e1..f412016dc635c200c273d039fdf0a7161b2d6c5a 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -12,6 +12,9 @@ What's New in Python 2.6 alpha 1?
 Core and builtins
 -----------------
 
+- Object/structseq.c: Implemented new structseq representation. structseqs
+  like the return value of os.stat are more readable.
+
 - Patch #1700288: added a type attribute cache that caches method accesses,
   resulting in speedups in heavily object-oriented code.