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

US Daylight Time broke test_format_time and some doctests #992

Closed
hroncok opened this issue Mar 18, 2023 · 2 comments
Closed

US Daylight Time broke test_format_time and some doctests #992

hroncok opened this issue Mar 18, 2023 · 2 comments

Comments

@hroncok
Copy link
Contributor

hroncok commented Mar 18, 2023

$ git rev-parse HEAD
134c792df3b6aa84de3e74e81a875493c95dcc2e

$ tox -e py311
...
...
python  -m pytest --cov=babel --cov-report=xml:.coverage_cache/coverage.py311.xml
============================= test session starts ==============================
platform linux -- Python 3.11.2, pytest-7.2.2, pluggy-1.0.0
cachedir: .tox/py311/.pytest_cache
rootdir: .../babel, configfile: setup.cfg
plugins: cov-4.0.0
collected 4900 items

...
=================================== FAILURES ===================================
______________________ [doctest] babel.dates.format_time _______________________
770     what a given time would translate to in a different timezone without
771     information about whether daylight savings time is in effect or not. This
772     means that time values are left as-is, and the value of the `tzinfo`
773     parameter is only used to display the timezone name if needed:
774 
775     >>> t = time(15, 30)
776     >>> format_time(t, format='full', tzinfo=get_timezone('Europe/Paris'),
777     ...             locale='fr_FR')
778     u'15:30:00 heure normale d\u2019Europe centrale'
779     >>> format_time(t, format='full', tzinfo=get_timezone('US/Eastern'),
Expected:
    u'3:30:00\u202fPM Eastern Standard Time'
Got:
    '3:30:00\u202fPM Eastern Daylight Time'

.../babel/babel/dates.py:779: DocTestFailure
___________________ [doctest] babel.dates.get_timezone_name ____________________
536 Return the localized display name for the given timezone. The timezone
537     may be specified using a ``datetime`` or `tzinfo` object.
538 
539     >>> from datetime import time
540     >>> dt = time(15, 30, tzinfo=get_timezone('America/Los_Angeles'))
541     >>> get_timezone_name(dt, locale='en_US')
Expected:
    u'Pacific Standard Time'
Got:
    'Pacific Daylight Time'

.../babel/babel/dates.py:541: DocTestFailure
_____________________ test_format_time[zoneinfo.ZoneInfo] ______________________

timezone_getter = <class 'zoneinfo.ZoneInfo'>

    def test_format_time(timezone_getter):
        t = time(15, 30)
        assert dates.format_time(t, locale='en_US') == '3:30:00\u202fPM'
        assert dates.format_time(t, format='short', locale='de_DE') == '15:30'
    
        assert (dates.format_time(t, "hh 'o''clock' a", locale='en') ==
                "03 o'clock PM")
    
        paris = timezone_getter('Europe/Paris')
        eastern = timezone_getter('US/Eastern')
    
        t = _localize(paris, datetime(2007, 4, 1, 15, 30))
        fr = dates.format_time(t, format='full', tzinfo=paris, locale='fr_FR')
        assert fr == '15:30:00 heure d’été d’Europe centrale'
    
        custom = dates.format_time(t, "hh 'o''clock' a, zzzz", tzinfo=eastern, locale='en')
        assert custom == "09 o'clock AM, Eastern Daylight Time"
    
        t = time(15, 30)
        paris = dates.format_time(t, format='full', tzinfo=paris, locale='fr_FR')
        assert paris == '15:30:00 heure normale d’Europe centrale'
    
        us_east = dates.format_time(t, format='full', tzinfo=eastern, locale='en_US')
>       assert us_east == '3:30:00\u202fPM Eastern Standard Time'
E       AssertionError: assert '3:30:00\u202...Daylight Time' == '3:30:00\u202...Standard Time'
E         - 3:30:00 PM Eastern Standard Time
E         ?                    ^ ------
E         + 3:30:00 PM Eastern Daylight Time
E         ?                    ^^^^^^^

tests/test_dates.py:609: AssertionError

...

=========================== short test summary info ============================
FAILED babel/dates.py::babel.dates.format_time
FAILED babel/dates.py::babel.dates.get_timezone_name
FAILED tests/test_dates.py::test_format_time[zoneinfo.ZoneInfo] - AssertionEr...
================= 3 failed, 4041 passed, 856 skipped in 9.18s ==================
make: *** [Makefile:2: test] Error 1
ERROR: InvocationError for command /usr/bin/make clean-cldr test (exited with code 2)
___________________________________ summary ____________________________________
ERROR:   py311: commands failed
@jun66j5
Copy link
Contributor

jun66j5 commented Mar 18, 2023

The same issue of #988. I'd suggest to search open and closed issues before submitting new issue.

@hroncok
Copy link
Contributor Author

hroncok commented Mar 18, 2023

My apologies, I accidentally looked over open Pull Requests insted of Issues.

@hroncok hroncok closed this as not planned Won't fix, can't repro, duplicate, stale Mar 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants