Python unicodedata 模块,__file__() 实例源码

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

项目:zippy    作者:securesystemslab    | 项目源码 | 文件源码
def test_getfile(self):
        self.assertEqual(inspect.getfile(mod.StupidGit), mod.__file__)
项目:zippy    作者:securesystemslab    | 项目源码 | 文件源码
def test_getmodule_recursion(self):
        from types import ModuleType
        name = '__inspect_dummy'
        m = sys.modules[name] = ModuleType(name)
        m.__file__ = "<string>" # hopefully not a real filename...
        m.__loader__ = "dummy"  # pretend the filename is understood by a loader
        exec("def x(): pass", m.__dict__)
        self.assertEqual(inspect.getsourcefile(m.x.__code__), '<string>')
        del sys.modules[name]
        inspect.getmodule(compile('a=10','','single'))
项目:zippy    作者:securesystemslab    | 项目源码 | 文件源码
def test_no_dict_no_slots_instance_member(self):
        # returns descriptor
        with open(__file__) as handle:
            self.assertEqual(inspect.getattr_static(handle, 'name'), type(handle).name)
项目:oil    作者:oilshell    | 项目源码 | 文件源码
def test_getfile(self):
        self.assertEqual(inspect.getfile(mod.StupidGit), mod.__file__)
项目:oil    作者:oilshell    | 项目源码 | 文件源码
def test_getmodule_recursion(self):
        from types import ModuleType
        name = '__inspect_dummy'
        m = sys.modules[name] = ModuleType(name)
        m.__file__ = "<string>" # hopefully not a real filename...
        m.__loader__ = "dummy"  # pretend the filename is understood by a loader
        exec "def x(): pass" in m.__dict__
        self.assertEqual(inspect.getsourcefile(m.x.func_code), '<string>')
        del sys.modules[name]
        inspect.getmodule(compile('a=10','','single'))
项目:python2-tracer    作者:extremecoders-re    | 项目源码 | 文件源码
def test_getfile(self):
        self.assertEqual(inspect.getfile(mod.StupidGit), mod.__file__)
项目:python2-tracer    作者:extremecoders-re    | 项目源码 | 文件源码
def test_getmodule_recursion(self):
        from types import ModuleType
        name = '__inspect_dummy'
        m = sys.modules[name] = ModuleType(name)
        m.__file__ = "<string>" # hopefully not a real filename...
        m.__loader__ = "dummy"  # pretend the filename is understood by a loader
        exec "def x(): pass" in m.__dict__
        self.assertEqual(inspect.getsourcefile(m.x.func_code), '<string>')
        del sys.modules[name]
        inspect.getmodule(compile('a=10','','single'))
项目:web_ctp    作者:molebot    | 项目源码 | 文件源码
def test_getfile(self):
        self.assertEqual(inspect.getfile(mod.StupidGit), mod.__file__)
项目:web_ctp    作者:molebot    | 项目源码 | 文件源码
def test_getmodule_recursion(self):
        from types import ModuleType
        name = '__inspect_dummy'
        m = sys.modules[name] = ModuleType(name)
        m.__file__ = "<string>" # hopefully not a real filename...
        m.__loader__ = "dummy"  # pretend the filename is understood by a loader
        exec("def x(): pass", m.__dict__)
        self.assertEqual(inspect.getsourcefile(m.x.__code__), '<string>')
        del sys.modules[name]
        inspect.getmodule(compile('a=10','','single'))
项目:web_ctp    作者:molebot    | 项目源码 | 文件源码
def test_no_dict_no_slots_instance_member(self):
        # returns descriptor
        with open(__file__) as handle:
            self.assertEqual(inspect.getattr_static(handle, 'name'), type(handle).name)
项目:pefile.pypy    作者:cloudtracer    | 项目源码 | 文件源码
def test_getfile(self):
        self.assertEqual(inspect.getfile(mod.StupidGit), mod.__file__)
项目:pefile.pypy    作者:cloudtracer    | 项目源码 | 文件源码
def test_getmodule_recursion(self):
        from types import ModuleType
        name = '__inspect_dummy'
        m = sys.modules[name] = ModuleType(name)
        m.__file__ = "<string>" # hopefully not a real filename...
        m.__loader__ = "dummy"  # pretend the filename is understood by a loader
        exec "def x(): pass" in m.__dict__
        self.assertEqual(inspect.getsourcefile(m.x.func_code), '<string>')
        del sys.modules[name]
        inspect.getmodule(compile('a=10','','single'))
项目:ndk-python    作者:gittor    | 项目源码 | 文件源码
def test_getfile(self):
        self.assertEqual(inspect.getfile(mod.StupidGit), mod.__file__)
项目:ndk-python    作者:gittor    | 项目源码 | 文件源码
def test_getmodule_recursion(self):
        from types import ModuleType
        name = '__inspect_dummy'
        m = sys.modules[name] = ModuleType(name)
        m.__file__ = "<string>" # hopefully not a real filename...
        m.__loader__ = "dummy"  # pretend the filename is understood by a loader
        exec "def x(): pass" in m.__dict__
        self.assertEqual(inspect.getsourcefile(m.x.func_code), '<string>')
        del sys.modules[name]
        inspect.getmodule(compile('a=10','','single'))
项目:kbe_server    作者:xiaohaoppy    | 项目源码 | 文件源码
def test_getfile(self):
        self.assertEqual(inspect.getfile(mod.StupidGit), mod.__file__)
项目:kbe_server    作者:xiaohaoppy    | 项目源码 | 文件源码
def test_getmodule_recursion(self):
        from types import ModuleType
        name = '__inspect_dummy'
        m = sys.modules[name] = ModuleType(name)
        m.__file__ = "<string>" # hopefully not a real filename...
        m.__loader__ = "dummy"  # pretend the filename is understood by a loader
        exec("def x(): pass", m.__dict__)
        self.assertEqual(inspect.getsourcefile(m.x.__code__), '<string>')
        del sys.modules[name]
        inspect.getmodule(compile('a=10','','single'))
项目:kbe_server    作者:xiaohaoppy    | 项目源码 | 文件源码
def test_no_dict_no_slots_instance_member(self):
        # returns descriptor
        with open(__file__) as handle:
            self.assertEqual(inspect.getattr_static(handle, 'name'), type(handle).name)
项目:kbe_server    作者:xiaohaoppy    | 项目源码 | 文件源码
def test_details(self):
        module = importlib.import_module('unittest')
        rc, out, err = assert_python_ok('-m', 'inspect',
                                        'unittest', '--details')
        output = out.decode()
        # Just a quick sanity check on the output
        self.assertIn(module.__name__, output)
        self.assertIn(module.__file__, output)
        if not sys.flags.optimize:
            self.assertIn(module.__cached__, output)
        self.assertEqual(err, b'')