Skip to content

Tests fail on days when EST/EDT swap happens #988

@mweinelt

Description

@mweinelt

Overview Description

Timezone related test fails on Babel 1.12.1 around when eastern daylight and eastern standard time swap.

Steps to Reproduce

  1. Run the tests on the 2nd sunday of march or the 1st sunday in november

Actual Results

_____________________ 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:00PM Eastern Standard Time
E         ?                    ^ ------
E         + 3:30:00PM Eastern Daylight Time
E         ?                    ^^^^^^^

tests/test_dates.py:609: AssertionError

Expected Results

Tests should likely be frozen in time.

Reproducibility

Around when the daylight saving time goes in and out of effect.

Additional Information

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions