[ python-Bugs-883604 ] locale specific problem in test_strftime.py

SourceForge.net noreply at sourceforge.net
Mon Mar 1 23:57:05 EST 2004


Bugs item #883604, was opened at 2004-01-24 05:21
Message generated for change (Settings changed) made by bcannon
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=883604&group_id=5470

Category: Python Library
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: George Yoshida (quiver)
>Assigned to: Brett Cannon (bcannon)
Summary: locale specific problem in test_strftime.py

Initial Comment:
test/test_strftime.py compares an expectation and a 
result by regular expressions, but the pattern isn't 
escaped. So if the expectation includes a metacharacter,
  expectation == result
and
  re.match(expectation, result)
do not always return the same value.

In my case on Japanese Windows, time.tzname returns
  ('\x93\x8c\x8b\x9e (\x95W\x8f\x80\x8e\x9e)', '\x93
\x8c\x8b\x9e (\x95W\x8f\x80\x8e\x9e)')
The output contains parentheses. 
This resuls in a message:
  Conflict for nonstandard '%Z' format (time zone name):
    Expected “Œ‹ž (•W€Žž), but got “Œ‹ž (•W€Žž)
re.match(foo, bar) != (foo == bar)

One workaround I can think of is changing re.match(e
[1], result) back to result == e[1].


----------------------------------------------------------------------

Comment By: Brett Cannon (bcannon)
Date: 2004-01-29 18:23

Message:
Logged In: YES 
user_id=357491

That's not what I meant by the comment; sorry for not being 
clearer.  I meant is whether test_strftime's existence is because of 
Jython.

----------------------------------------------------------------------

Comment By: George Yoshida (quiver)
Date: 2004-01-29 03:54

Message:
Logged In: YES 
user_id=671362

> Is  this for Jython or something?
No, it's Python 2.3.3 on Windows 2000.

time zone is classified as non standard(unpredictable) so it 
might be difficult to make test_stftime.py to support all 
locales. There are so many issues.

FYI, I checked time.tzname on other platforms.

# Jython
Jython 2.1 on java1.4.2 (JIT: null)
Type "copyright", "credits" or "license" for more information.
>>> import time
>>> time.tzname
('JST', 'JST')  # Japanese Standard Time

# Linux
On RHL 9.0(Python 2.2/2.3), time.tzname returns ('JST', 'JST').

They pass the test.


----------------------------------------------------------------------

Comment By: Brett Cannon (bcannon)
Date: 2004-01-27 00:28

Message:
Logged In: YES 
user_id=357491

Does anyone know why we even have test_strftime?  It isn't like 
we have our own implementation and there are basic tests in 
test_time to make sure the wrapper around the C function works.  
I know the test module says it is for sanity checks, but if it fails 
legitimately on a platform there is not much we can do about it.  
Is this for Jython or something?

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=883604&group_id=5470



More information about the Python-bugs-list mailing list