Huh, right, stupid me. I was so focused on the unicode part I
completely brainfarted the rest.
I'll fix that, sorry.
Florent
On 31 May 2005, at 20:18, Tim Peters wrote:
[Florent Guillaume]
Log message for revision 30570:
Added test for strftime with unicode pattern.
Changed:
U Zope/branches/Zope-2_8-branch/lib/python/DateTime/tests/
testDateTime.py
-=-
Modified: Zope/branches/Zope-2_8-branch/lib/python/DateTime/tests/
testDateTime.py
===================================================================
--- Zope/branches/Zope-2_8-branch/lib/python/DateTime/tests/
testDateTime.py 2005-05-31 14:30:17 UTC (rev 30569)
+++ Zope/branches/Zope-2_8-branch/lib/python/DateTime/tests/
testDateTime.py 2005-05-31 14:58:17 UTC (rev 30570)
@@ -373,7 +373,10 @@
dt2 = DateTime('2040/01/30 11:33 GMT-2')
self.assertEqual(dt1.strftime('%d/%m/%Y %H:%M'),
dt2.strftime('%d/%m/%Y %H:%M'))
-
+ def testStrftimeUnicode(self):
+ dt = DateTime('2002-05-02T08:00:00+00:00')
+ self.assertEqual(dt.strftime(u'Le %d/%m/%Y \xe0 %Hh%M'),
+ u'Le 02/05/2002 \xe0 10h00')
...
Is this a correct test? It failed when I ran it today:
FAIL: testStrftimeUnicode (DateTime.tests.testDateTime.DateTimeTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Code\Zope\lib\python\DateTime\tests\testDateTime.py", line
379, in testStrftimeUnicode
u'Le 02/05/2002 \xe0 10h00')
File "C:\python23\lib\unittest.py", line 302, in failUnlessEqual
raise self.failureException, \
AssertionError: u'Le 02/05/2002 \xe0 04h00' != u'Le 02/05/2002 \xe0
10h00'
Looks like the conversion produces a string depending on the time zone
in use on the box where the test is run; I'm in US Eastern, and
import calendar
ts = calendar.timegm((2002, 5, 2, 8, 0, 0, -1, -1, -1))
import time
time.ctime(ts)
'Thu May 02 04:00:00 2002'
here. That is, the result I got is the correct result for my time
zone (4 west of UTC in daylight time). The result the test wants is
two hours east of UTC -- which sounds suspiciously French to me
<wink>.
--
Florent Guillaume, Nuxeo (Paris, France) CTO, Director of R&D
+33 1 40 33 71 59 http://nuxeo.com [EMAIL PROTECTED]
_______________________________________________
Zope-Checkins maillist - [email protected]
http://mail.zope.org/mailman/listinfo/zope-checkins