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

Method test_implementation

Lib/test/test_sys.py:1084–1114  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1082 self.check_locale_surrogateescape('POSIX')
1083
1084 def test_implementation(self):
1085 # This test applies to all implementations equally.
1086
1087 levels = {'alpha': 0xA, 'beta': 0xB, 'candidate': 0xC, 'final': 0xF}
1088
1089 self.assertHasAttr(sys.implementation, 'name')
1090 self.assertHasAttr(sys.implementation, 'version')
1091 self.assertHasAttr(sys.implementation, 'hexversion')
1092 self.assertHasAttr(sys.implementation, 'cache_tag')
1093 self.assertHasAttr(sys.implementation, 'supports_isolated_interpreters')
1094
1095 version = sys.implementation.version
1096 self.assertEqual(version[:2], (version.major, version.minor))
1097
1098 hexversion = (version.major << 24 | version.minor << 16 |
1099 version.micro << 8 | levels[version.releaselevel] << 4 |
1100 version.serial << 0)
1101 self.assertEqual(sys.implementation.hexversion, hexversion)
1102
1103 # PEP 421 requires that .name be lower case.
1104 self.assertEqual(sys.implementation.name,
1105 sys.implementation.name.lower())
1106
1107 # https://peps.python.org/pep-0734
1108 sii = sys.implementation.supports_isolated_interpreters
1109 self.assertIsInstance(sii, bool)
1110 if test.support.check_impl_detail(cpython=True):
1111 if test.support.is_emscripten or test.support.is_wasi:
1112 self.assertFalse(sii)
1113 else:
1114 self.assertTrue(sii)
1115
1116 @test.support.cpython_only
1117 def test_debugmallocstats(self):

Callers

nothing calls this directly

Calls 6

assertHasAttrMethod · 0.80
assertIsInstanceMethod · 0.80
assertFalseMethod · 0.80
assertTrueMethod · 0.80
assertEqualMethod · 0.45
lowerMethod · 0.45

Tested by

no test coverage detected