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

Commit287c559

Browse files
musically-utvstinner
authored andcommitted
bpo-30822: Fix testing of datetime module. (#2530) (#2783)
Only C implementation was tested.
1 parentfff2a21 commit287c559

File tree

4 files changed

+15
-9
lines changed

4 files changed

+15
-9
lines changed

‎Lib/datetime.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2271,7 +2271,8 @@ def _name_from_offset(delta):
22712271
_check_tzinfo_arg,_check_tzname,_check_utc_offset,_cmp,_cmperror,
22722272
_date_class,_days_before_month,_days_before_year,_days_in_month,
22732273
_format_time,_is_leap,_isoweek1monday,_math,_ord2ymd,
2274-
_time,_time_class,_tzinfo_class,_wrap_strftime,_ymd2ord)
2274+
_time,_time_class,_tzinfo_class,_wrap_strftime,_ymd2ord,
2275+
_divide_and_round)
22752276
# XXX Since import * above excludes names that start with _,
22762277
# docstring does not get overwritten. In the future, it may be
22772278
# appropriate to maintain a single module level docstring and

‎Lib/test/datetimetester.py‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,9 @@ def test_constants(self):
6161
self.assertEqual(datetime.MAXYEAR,9999)
6262

6363
deftest_name_cleanup(self):
64-
if'_Fast'notinstr(self):
65-
return
64+
if'_Pure'inself.__class__.__name__:
65+
self.skipTest('Only run for Fast C implementation')
66+
6667
datetime=datetime_module
6768
names=set(namefornameindir(datetime)
6869
ifnotname.startswith('__')andnotname.endswith('__'))
@@ -72,8 +73,9 @@ def test_name_cleanup(self):
7273
self.assertEqual(names-allowed,set([]))
7374

7475
deftest_divide_and_round(self):
75-
if'_Fast'instr(self):
76-
return
76+
if'_Fast'inself.__class__.__name__:
77+
self.skipTest('Only run for Pure Python implementation')
78+
7779
dar=datetime_module._divide_and_round
7880

7981
self.assertEqual(dar(-10,-3),3)
@@ -2851,7 +2853,7 @@ def tzname(self, dt): return self.tz
28512853
self.assertRaises(TypeError,t.strftime,"%Z")
28522854

28532855
# Issue #6697:
2854-
if'_Fast'instr(self):
2856+
if'_Fast'inself.__class__.__name__:
28552857
Badtzname.tz='\ud800'
28562858
self.assertRaises(ValueError,t.strftime,"%Z")
28572859

‎Lib/test/test_datetime.py‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
# XXX(gb) First run all the _Pure tests, then all the _Fast tests. You might
2121
# not believe this, but in spite of all the sys.modules trickery running a _Pure
2222
# test last will leave a mix of pure and native datetime stuff lying around.
23-
test_classes= []
23+
all_test_classes= []
2424

2525
formodule,suffixinzip(test_modules,test_suffixes):
2626
test_classes= []
@@ -34,7 +34,8 @@
3434
test_classes.extend(type(test)fortestinsuit)
3535
test_classes=sorted(set(test_classes),key=lambdacls:cls.__qualname__)
3636
forclsintest_classes:
37-
cls.__name__=name+suffix
37+
cls.__name__+=suffix
38+
cls.__qualname__+=suffix
3839
@classmethod
3940
defsetUpClass(cls_,module=module):
4041
cls_._save_sys_modules=sys.modules.copy()
@@ -47,9 +48,10 @@ def tearDownClass(cls_):
4748
sys.modules.update(cls_._save_sys_modules)
4849
cls.setUpClass=setUpClass
4950
cls.tearDownClass=tearDownClass
51+
all_test_classes.extend(test_classes)
5052

5153
deftest_main():
52-
run_unittest(*test_classes)
54+
run_unittest(*all_test_classes)
5355

5456
if__name__=="__main__":
5557
test_main()

‎Misc/ACKS‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1602,6 +1602,7 @@ Doobee R. Tzeck
16021602
Eren Türkay
16031603
Lionel Ulmer
16041604
Adnan Umer
1605+
Utkarsh Upadhyay
16051606
Roger Upole
16061607
Daniel Urban
16071608
Michael Urman

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2026 Movatter.jp