Skip to content

test_strftime incorrectly calculates expected week #133940

@StanFromIreland

Description

@StanFromIreland

Bug report

Bug description:

This is not a duplicate of other IST related issues, this is just a bug in the test itself from a quick look. After further investigation it appears this is indeed just a IST bug but the test also calculates it wrong.
From buildbot run (on IST):

======================================================================
FAIL: test_strftime (test.test_strftime.StrftimeTest.test_strftime)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/stan/buildarea/3.x.stan-raspbian/build/Lib/test/test_strftime.py", line 65, in test_strftime
    self.strftest1(now)
    ~~~~~~~~~~~~~~^^^^^
  File "/home/stan/buildarea/3.x.stan-raspbian/build/Lib/test/test_strftime.py", line 124, in strftest1
    self.fail("Conflict for %s (%s): expected %s, but got %s"
    ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
              % (e[0], e[2], e[1], result))
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: Conflict for %W (week number of the year (Mon 1st)): expected 18, but got 19
Stdout:
strftime test for Mon May 12 18:08:48 2025
----------------------------------------------------------------------
Ran 4 tests in 0.049s

It seems both the expected and returned are wrong, according to this website it should be week 20. Week 0 is days before the first week, so it would exist in our case, if it is counted, then the returned value is correct, but the test is wrong. Test passes in UTC however.

CPython versions tested on:

CPython main branch

Operating systems tested on:

Linux

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    testsTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or error

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions