[Python-checkins] r59947 - in python/trunk: Lib/test/test_structseq.py Misc/NEWS

christian.heimes python-checkins at python.org
Mon Jan 14 04:33:53 CET 2008


Author: christian.heimes
Date: Mon Jan 14 04:33:52 2008
New Revision: 59947
Modified:
 python/trunk/Lib/test/test_structseq.py
 python/trunk/Misc/NEWS
Log:
Added new an better structseq representation. E.g. repr(time.gmtime(0)) now returns '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)' instead of '(1970, 1, 1, 0, 0, 0, 3, 1, 0)'. The feature is part of #1816: sys.flags
Modified: python/trunk/Lib/test/test_structseq.py
==============================================================================
--- python/trunk/Lib/test/test_structseq.py	(original)
+++ python/trunk/Lib/test/test_structseq.py	Mon Jan 14 04:33:52 2008
@@ -28,7 +28,11 @@
 
 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()
Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS	(original)
+++ python/trunk/Misc/NEWS	Mon Jan 14 04:33:52 2008
@@ -12,6 +12,9 @@
 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.
 


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /