Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broken testsuite #106

Closed
nijel opened this issue Jul 24, 2014 · 3 comments
Closed

Broken testsuite #106

nijel opened this issue Jul 24, 2014 · 3 comments

Comments

@nijel
Copy link

nijel commented Jul 24, 2014

The Babel testsuite (and maybe the code as well, I did not check) is broken as it uses pytz API which is documented not to work. In short pytz timezones should not be used as tzinfo parameter to date/datetime functions, but rather the localize method should be used. See https://bugs.launchpad.net/pytz/+bug/1324158 for pytz bugreports and note in pytz documentation: http://pythonhosted.org//pytz/#introduction

[   42s] =================================== FAILURES ===================================
[   42s] ___________________ DateTimeFormatTestCase.test_timezone_gmt ___________________
[   42s] 
[   42s] self = <tests.test_dates.DateTimeFormatTestCase testMethod=test_timezone_gmt>
[   42s] 
[   42s]     def test_timezone_gmt(self):
[   42s]         tz = timezone('Europe/Berlin')
[   42s]         t = time(15, 30, tzinfo=tz)
[   42s]         fmt = dates.DateTimeFormat(t, locale='de_DE')
[   42s] >       self.assertEqual('GMT+01:00', fmt['ZZZZ'])
[   42s] E       AssertionError: 'GMT+01:00' != u'GMT+00:53'
[   42s] 
[   42s] tests/test_dates.py:188: AssertionError
[   42s] _________________ DateTimeFormatTestCase.test_timezone_rfc822 __________________
[   42s] 
[   42s] self = <tests.test_dates.DateTimeFormatTestCase testMethod=test_timezone_rfc822>
[   42s] 
[   42s]     def test_timezone_rfc822(self):
[   42s]         tz = timezone('Europe/Berlin')
[   42s]         t = time(15, 30, tzinfo=tz)
[   42s]         fmt = dates.DateTimeFormat(t, locale='de_DE')
[   42s] >       self.assertEqual('+0100', fmt['Z'])
[   42s] E       AssertionError: '+0100' != u'+0053'
[   42s] 
[   42s] tests/test_dates.py:182: AssertionError
[   42s] ____________________________ test_get_timezone_gmt _____________________________
[   42s] 
[   42s]     def test_get_timezone_gmt():
[   42s]         dt = datetime(2007, 4, 1, 15, 30)
[   42s]         assert dates.get_timezone_gmt(dt, locale='en') == u'GMT+00:00'
[   42s]     
[   42s]         tz = timezone('America/Los_Angeles')
[   42s]         dt = datetime(2007, 4, 1, 15, 30, tzinfo=tz)
[   42s] >       assert dates.get_timezone_gmt(dt, locale='en') == u'GMT-08:00'
[   42s] E       assert 'GMT-08:07' == 'GMT-08:00'
[   42s] E         - GMT-08:07
[   42s] E         ?         ^
[   42s] E         + GMT-08:00
[   42s] E         ?         ^
[   42s] 
[   42s] tests/test_dates.py:384: AssertionError
[   42s] ===================== 3 failed, 320 passed in 1.98 seconds =====================
tzjames pushed a commit to Khan/babel that referenced this issue Sep 16, 2014
Summary:
Just like we did for javascript in:
http://phabricator.khanacademy.org/rBAe053e691f92c32e3cf9f9bd82facf121c80d6f09

We now will merge multi-line comments onto a single line for messages
extracted from python too.  This is an issue for us since we sort the
comments in order to make the diffs cleaner, and unless the comment
lines were in alphabetical order they got scrambled up.

While at it I also fixed a spelling mistake in one of the test files.

Test Plan:
cd third-party/babel-khansrc
make standalone-test
It spits out 3 errors, but that is a known issue:
python-babel/babel#106

Reviewers: csilvers

Reviewed By: csilvers

Differential Revision: http://phabricator.khanacademy.org/D13207
@blagasz
Copy link
Member

blagasz commented Oct 21, 2014

I made the necessary changes and added to my other pull request.

I think there were a wrong assumption in the test suite according to:
http://wwp.greenwichmeantime.com/time-zone/usa/california/los-angeles/time-los-angeles/

I also found two of the test incomprehensible in their original form.

@benselme
Copy link
Member

benselme commented Jan 8, 2015

Dupe of #133, fixed by #134

@etanol
Copy link
Contributor

etanol commented Sep 26, 2015

Already fixed, a couple of times apparently. Closing.

@etanol etanol closed this as completed Sep 26, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants