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

Method test_read_shebang

Lib/test/test_zipapp.py:264–271  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

262 self.assertStartsWith(target.getvalue(), b'#!python\n')
263
264 def test_read_shebang(self):
265 # Test that we can read the shebang line correctly.
266 source = self.tmpdir / 'source'
267 source.mkdir()
268 (source / '__main__.py').touch()
269 target = self.tmpdir / 'source.pyz'
270 zipapp.create_archive(str(source), str(target), interpreter='python')
271 self.assertEqual(zipapp.get_interpreter(str(target)), 'python')
272
273 def test_read_missing_shebang(self):
274 # Test that reading the shebang line of a file without one returns None.

Callers

nothing calls this directly

Calls 5

strFunction · 0.85
get_interpreterMethod · 0.80
mkdirMethod · 0.45
touchMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected