Skip to content

Commit c6cc066

Browse files
committed
Merge two tests (1)
1 parent fb35703 commit c6cc066

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

Lib/test/datetimetester.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7304,7 +7304,7 @@ def test_update_type_cache(self):
73047304
def assert_python_in_subinterp(self, *args, **kwargs):
73057305
return CapiTest.assert_python_in_subinterp(self, *args, **kwargs)
73067306

7307-
def test_static_type_attr_on_subinterp(self):
7307+
def test_static_type_on_subinterp(self):
73087308
script = textwrap.dedent(f"""
73097309
date = _testcapi.get_capi_types()['date']
73107310
date.today
@@ -7326,6 +7326,18 @@ def test_static_type_attr_on_subinterp(self):
73267326
with self.subTest('Regular import'):
73277327
self.assert_python_in_subinterp(True, script3)
73287328

7329+
script4 = textwrap.dedent(f"""
7330+
import sys
7331+
assert '_datetime' not in sys.modules
7332+
timedelta = _testcapi.get_capi_types()['timedelta']
7333+
timedelta(days=1)
7334+
assert '_datetime' in sys.modules
7335+
date = _testcapi.get_capi_types()['date']
7336+
date.today
7337+
""")
7338+
with self.subTest('Implicit import'):
7339+
self.assert_python_in_subinterp(True, script4)
7340+
73297341
def test_static_type_at_shutdown1(self):
73307342
# gh-132413
73317343
script = textwrap.dedent("""
@@ -7395,16 +7407,6 @@ def gen():
73957407
res = self.assert_python_in_subinterp(True, script2)
73967408
self.assertFalse(res.err)
73977409

7398-
def test_static_type_before_shutdown(self):
7399-
script = textwrap.dedent(f"""
7400-
import sys
7401-
assert '_datetime' not in sys.modules
7402-
timedelta = _testcapi.get_capi_types()['timedelta']
7403-
timedelta(days=1)
7404-
assert '_datetime' in sys.modules
7405-
""")
7406-
self.assert_python_in_subinterp(True, script)
7407-
74087410
def test_module_free(self):
74097411
script = textwrap.dedent("""
74107412
import sys

0 commit comments

Comments
 (0)