我们从Python开源项目中,提取了以下4个代码示例,用于说明如何使用sys.py()。
def test_extended_opargs(self): extended_opargs_test = [ "a", ["a", "b"], [], [], """\ a.py %r import b b.py """ % range(2**16)] # 2**16 constants self._do_test(extended_opargs_test)
def test_replace_paths(self): old_path = os.path.join(TEST_DIR, 'a', 'module.py') new_path = os.path.join(TEST_DIR, 'a', 'spam.py') with support.captured_stdout() as output: self._do_test(maybe_test, debug=2, replace_paths=[(old_path, new_path)]) output = output.getvalue() expected = "co_filename %r changed to %r" % (old_path, new_path) self.assertIn(expected, output)