MCPcopy Index your code
hub / github.com/python/cpython / test_gh_120161

Method test_gh_120161

Lib/test/datetimetester.py:7408–7440  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

7406
7407 @support.cpython_only
7408 def test_gh_120161(self):
7409 with self.subTest('simple'):
7410 script = textwrap.dedent("""
7411 import datetime
7412 from _ast import Tuple
7413 f = lambda: None
7414 Tuple.dims = property(f, f)
7415
7416 class tzutc(datetime.tzinfo):
7417 pass
7418 """)
7419 script_helper.assert_python_ok('-c', script)
7420
7421 with self.subTest('complex'):
7422 script = textwrap.dedent("""
7423 import asyncio
7424 import datetime
7425 from typing import Type
7426
7427 class tzutc(datetime.tzinfo):
7428 pass
7429 _EPOCHTZ = datetime.datetime(1970, 1, 1, tzinfo=tzutc())
7430
7431 class FakeDateMeta(type):
7432 def __instancecheck__(self, obj):
7433 return True
7434 class FakeDate(datetime.date, metaclass=FakeDateMeta):
7435 pass
7436 def pickle_fake_date(datetime_) -> Type[FakeDate]:
7437 # A pickle function for FakeDate
7438 return FakeDate
7439 """)
7440 script_helper.assert_python_ok('-c', script)
7441
7442 def test_update_type_cache(self):
7443 # gh-120782

Callers

nothing calls this directly

Calls 3

assert_python_okMethod · 0.80
subTestMethod · 0.45
dedentMethod · 0.45

Tested by

no test coverage detected