Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32.1k
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:mainChoose a base branch fromCharlieZhao95:fix_test_strptime
base:main
Could not load branches
Branch not found:{{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline, and old review comments may become outdated.
+4 −4
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Contributor
StanFromIreland left a comment• edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading.Please reload this page.
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.test_strptime
fails whentime.strftime
does not support%Z
format string #121782