Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-121782: Remove deprecated%Z directive in strftime-related tests#135200

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
CharlieZhao95 wants to merge1 commit intopython:main
base:main
Choose a base branch
Loading
fromCharlieZhao95:fix_test_strptime

Conversation

CharlieZhao95
Copy link
Contributor

@CharlieZhao95CharlieZhao95 commentedJun 6, 2025
edited by bedevere-appbot
Loading

The%Z intime.strftime is a platform-specific directive. It causesstrftime to return no characters on some platforms, which makes tests unstable.

But fortunately the%Z intime.strftime is deprecated, so we can remove it from those tests safely.

%Z: Time zone name (no characters if no time zone exists). Deprecated.

Copy link
Contributor

@StanFromIrelandStanFromIreland left a comment
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Just because it isdeprecated does not mean it should beremoved. It is not even hard deprecated IIRC?

The next should probably be hard-deprecating it for 3.16 IMO, then removing it.

Are these tests not affected?
./Lib/test/test_strptime.py:        timezone = time.strftime("%Z", self.time_tuple).lower()./Lib/test/test_strptime.py:        self.assertEqual(_strptime.TimeRE(test_locale).pattern("%Z"), '',./Lib/test/test_strptime.py:                         "with timezone == ('',''), TimeRE().pattern('%Z') != ''")./Lib/test/test_strptime.py:        self.assertTrue(time_re.compile("%Z").match("Tokyo (standard time)"),./Lib/test/test_strptime.py:        # When gmtime() is used with %Z, entire result of strftime() is empty../Lib/test/test_strptime.py:        strp_output = _strptime._strptime_time("UTC", "%Z")./Lib/test/test_strptime.py:        strp_output = _strptime._strptime_time("GMT", "%Z")./Lib/test/test_strptime.py:        strf_output = time.strftime("%Z")  #UTC does not have a timezone./Lib/test/test_strptime.py:        strp_output = _strptime._strptime_time(strf_output, "%Z")./Lib/test/test_strptime.py:            tz_value = _strptime._strptime_time(tz_name, "%Z")[8]./Lib/test/test_strptime.py:        format_string = "%Y %m %d %H %M %S %w %Z"./Lib/test/test_strptime.py:        format_string = "%Y %H %M %S %w %j %Z"./Lib/test/test_strptime.py:        format_string = "%Y %m %d %H %S %j %Z"./Lib/test/test_strptime.py:        tm = _strptime._strptime_time(time.tzname[0], '%Z')./Lib/test/test_strptime.py:        tm = _strptime._strptime_time(time.tzname[1], '%Z')./Lib/test/test_strptime.py:        tm = _strptime._strptime_time(time.tzname[0], '%Z')./Lib/test/test_strptime.py:        tm = _strptime._strptime_time(time.tzname[1], '%Z')./Lib/test/test_strptime.py:            _strptime._strptime_time(oldtzname[0], '%Z')./Lib/test/test_strptime.py:            _strptime._strptime_time(oldtzname[1], '%Z')./Lib/test/datetimetester.py:        # A naive object replaces %z, %:z and %Z w/ empty strings../Lib/test/datetimetester.py:        self.assertEqual(t.strftime("'%z' '%:z' '%Z'"), "'' '' ''")./Lib/test/datetimetester.py:                    "%z %:z %Z",./Lib/test/datetimetester.py:                    "%z %:z %Z",./Lib/test/datetimetester.py:        self.assertRaises(TypeError, t.strftime, '%Z')./Lib/test/datetimetester.py:            dt = strptime(dtstr, "%z %Z")./Lib/test/datetimetester.py:        dtstr, fmt = "+1234 UTC", "%z %Z"./Lib/test/datetimetester.py:        self.assertEqual(strptime("UTC", "%Z").tzinfo, None)./Lib/test/datetimetester.py:        # A naive object replaces %z, %:z and %Z with empty strings../Lib/test/datetimetester.py:        self.assertEqual(t.strftime("'%z' '%:z' '%Z'"), "'' '' ''")./Lib/test/datetimetester.py:        s1 = t.strftime('%I%p%Z')./Lib/test/datetimetester.py:        self.assertEqual(t.strftime('\U0001f4bb%I%p%Z\U0001f40d%X'), f'\U0001f4bb{s1}\U0001f40d{s2}')./Lib/test/datetimetester.py:        self.assertEqual(t.strftime('%I%p%Z\U0001f4bb%X\U0001f40d'), f'{s1}\U0001f4bb{s2}\U0001f40d')./Lib/test/datetimetester.py:        self.assertEqual(t.strftime('\ud83d%I%p%Z\udc0d%X'), f'\ud83d{s1}\udc0d{s2}')./Lib/test/datetimetester.py:        self.assertEqual(t.strftime('%I%p%Z\ud83d%X\udc0d'), f'{s1}\ud83d{s2}\udc0d')./Lib/test/datetimetester.py:        self.assertEqual(t.strftime('%I%p%Z\udc0d%X\ud83d'), f'{s1}\udc0d{s2}\ud83d')./Lib/test/datetimetester.py:        self.assertEqual(t.strftime('%I%p%Z\ud83d\udc0d%X'), f'{s1}\ud83d\udc0d{s2}')./Lib/test/datetimetester.py:        self.assertEqual(t.strftime('%I%p%Z\udcf0\udc9f\udc90\udc8d%X'), f'{s1}\udcf0\udc9f\udc90\udc8d{s2}')./Lib/test/datetimetester.py:        self.assertEqual(t.strftime('\0%I%p%Z\0%X'), f'\0{s1}\0{s2}')./Lib/test/datetimetester.py:        self.assertEqual(t.strftime('%I%p%Z\0%X\0'), f'{s1}\0{s2}\0')./Lib/test/datetimetester.py:                t = strptime(tstr, "%z %Z")./Lib/test/datetimetester.py:        tstr, fmt = "+1234 UTC", "%z %Z"./Lib/test/datetimetester.py:        self.assertEqual(strptime("UTC", "%Z").tzinfo, None)./Lib/test/datetimetester.py:        self.assertEqual(t1.strftime("%H:%M:%S %%Z=%Z %%z=%z %%:z=%:z"),./Lib/test/datetimetester.py:                                     "07:47:00 %Z=EST %z=-0500 %:z=-05:00")./Lib/test/datetimetester.py:        self.assertEqual(t2.strftime("%H:%M:%S %Z %z %:z"), "12:47:00 UTC +0000 +00:00")./Lib/test/datetimetester.py:        self.assertEqual(t3.strftime("%H:%M:%S %Z %z %:z"), "13:47:00 MET +0100 +01:00")./Lib/test/datetimetester.py:        yuck = FixedOffset(-1439, "%z %Z %%z%%Z")./Lib/test/datetimetester.py:        self.assertEqual(t1.strftime("%H:%M %%Z='%Z' %%z='%z'"),./Lib/test/datetimetester.py:                                     "23:59 %Z='%z %Z %%z%%Z' %z='-2359'")./Lib/test/datetimetester.py:        self.assertRaises(TypeError, t.strftime, "%Z")./Lib/test/datetimetester.py:        self.assertEqual(t.strftime("%Z"), '\ud800')./Lib/test/datetimetester.py:        self.assertEqual(local.strftime("%z %Z"), "-0500 EST")./Lib/test/datetimetester.py:        self.assertEqual(local.strftime("%z %Z"), "-0400 EDT")./Lib/test/datetimetester.py:        self.assertEqual(ldt.strftime("%c %Z%z"),./Lib/test/datetimetester.py:        self.assertEqual(ldt.strftime("%c %Z%z"),./Lib/test/datetimetester.py:        self.assertEqual(ldt.strftime("%c %Z%z"),./Lib/test/datetimetester.py:        self.assertEqual(gdt.strftime("%c %Z"),./Lib/test/datetimetester.py:        self.assertEqual(gdt.strftime("%c %Z"),./Lib/test/datetimetester.py:        self.assertEqual(gdt.strftime("%c %Z"),./Lib/test/datetimetester.py:        self.assertEqual(gdt.strftime("%c %Z"),./Lib/test/datetimetester.py:        if _time.strftime('%Z%z', tm) != 'LHST+1030':./Lib/test/datetimetester.py:        if _time.strftime('%Z%z', tm) != 'LHST+1030':./Lib/test/test_strftime.py:            # %Z see below./Lib/test/test_strftime.py:            ('%Z', '%s' % self.tz, 'time zone name'),./Lib/test/test_time.py:        tzname = time.strftime('%Z', tt)./Lib/test/test_time.py:        self.assertEqual(time.strftime('%Z', tt), tzname)./Lib/test/test_time.py:        t = time.strptime("UTC", "%Z")

cc@encukou

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@StanFromIrelandStanFromIrelandStanFromIreland left review comments

@pgansslepganssleAwaiting requested review from pgansslepganssle will be requested when the pull request is marked ready for reviewpganssle is a code owner

@abalkinabalkinAwaiting requested review from abalkinabalkin will be requested when the pull request is marked ready for reviewabalkin is a code owner

Assignees
No one assigned
Labels
testsTests in the Lib/test dir
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@CharlieZhao95@StanFromIreland

[8]ページ先頭

©2009-2025 Movatter.jp