Python sys 模块,py() 实例源码

我们从Python开源项目中,提取了以下4个代码示例,用于说明如何使用sys.py()

项目:oil    作者:oilshell    | 项目源码 | 文件源码
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)
项目:python2-tracer    作者:extremecoders-re    | 项目源码 | 文件源码
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)
项目:ouroboros    作者:pybee    | 项目源码 | 文件源码
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)
项目:kbe_server    作者:xiaohaoppy    | 项目源码 | 文件源码
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)