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

Method test_only_two_levels

Lib/test/test_compileall.py:1071–1082  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1069 self.check_hardlinks(script, docstring, assertion)
1070
1071 def test_only_two_levels(self):
1072 # Don't build the 3 optimization levels, but only 2
1073 for opts in ((0, 1), (1, 2), (0, 2)):
1074 with self.subTest(opts=opts):
1075 with self.temporary_directory():
1076 # code with no dostring and no assertion:
1077 # same bytecode for all optimization levels
1078 script = self.make_script(self.create_code())
1079 self.compile_dir(optimize=opts)
1080 pyc1 = get_pyc(script, opts[0])
1081 pyc2 = get_pyc(script, opts[1])
1082 self.assertTrue(is_hardlink(pyc1, pyc2))
1083
1084 def test_duplicated_levels(self):
1085 # compile_dir() must not fail if optimize contains duplicated

Callers

nothing calls this directly

Calls 8

temporary_directoryMethod · 0.95
make_scriptMethod · 0.95
create_codeMethod · 0.95
compile_dirMethod · 0.95
get_pycFunction · 0.85
is_hardlinkFunction · 0.85
assertTrueMethod · 0.80
subTestMethod · 0.45

Tested by

no test coverage detected