本文整理汇总了Python中rope.base.project.Project.get_pymodule方法的典型用法代码示例。如果您正苦于以下问题:Python Project.get_pymodule方法的具体用法?Python Project.get_pymodule怎么用?Python Project.get_pymodule使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rope.base.project.Project
的用法示例。
在下文中一共展示了Project.get_pymodule方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: RopeFolderTest
# 需要导入模块: from rope.base.project import Project [as 别名]
# 或者: from rope.base.project.Project import get_pymodule [as 别名]
#.........这里部分代码省略.........
myfile = self.project.get_file('myfile.txt')
file2 = self.project.get_file('file2.txt')
self.assertTrue(self.project.is_ignored(myfile))
self.assertFalse(self.project.is_ignored(file2))
def test_ignored_folders(self):
self.project = testutils.sample_project(ignored_resources=['myfolder'])
myfolder = self.project.root.create_folder('myfolder')
self.assertTrue(self.project.is_ignored(myfolder))
myfile = myfolder.create_file('myfile.txt')
self.assertTrue(self.project.is_ignored(myfile))
def test_ignored_resources_and_get_files(self):
self.project = testutils.sample_project(
ignored_resources=['myfile.txt'], ropefolder=None)
myfile = self.project.get_file('myfile.txt')
self.assertEquals(0, len(self.project.get_files()))
myfile.create()
self.assertEquals(0, len(self.project.get_files()))
def test_ignored_resources_and_get_files2(self):
self.project = testutils.sample_project(
ignored_resources=['myfile.txt'], ropefolder=None)
myfile = self.project.root.create_file('myfile.txt') # noqa
self.assertEquals(0, len(self.project.get_files()))
def test_setting_ignored_resources_patterns(self):
self.project = testutils.sample_project(ignored_resources=['m?file.*'])
myfile = self.project.get_file('myfile.txt')
file2 = self.project.get_file('file2.txt')
self.assertTrue(self.project.is_ignored(myfile))
self.assertFalse(self.project.is_ignored(file2))
def test_star_should_not_include_slashes(self):
self.project = testutils.sample_project(ignored_resources=['f*.txt'])
folder = self.project.root.create_folder('folder')
file1 = folder.create_file('myfile.txt')
file2 = folder.create_file('file2.txt')
self.assertFalse(self.project.is_ignored(file1))
self.assertTrue(self.project.is_ignored(file2))
def test_normal_fscommands(self):
fscommands = _MockFSCommands()
self.project = testutils.sample_project(fscommands=fscommands)
myfile = self.project.get_file('myfile.txt')
myfile.create()
self.assertTrue('create_file ', fscommands.log)
def test_fscommands_and_ignored_resources(self):
fscommands = _MockFSCommands()
self.project = testutils.sample_project(
fscommands=fscommands,
ignored_resources=['myfile.txt'], ropefolder=None)
myfile = self.project.get_file('myfile.txt')
myfile.create()
self.assertEquals('', fscommands.log)
def test_ignored_resources_and_prefixes(self):
self.project = testutils.sample_project(
ignored_resources=['.hg'])
myfile = self.project.root.create_file('.hgignore')
self.assertFalse(self.project.is_ignored(myfile))
def test_loading_config_dot_py(self):
self.project = testutils.sample_project(ropefolder='.ropeproject')
config = self.project.get_file('.ropeproject/config.py')
if not config.exists():
config.create()
config.write('def set_prefs(prefs):\n'
' prefs["ignored_resources"] = ["myfile.txt"]\n'
'def project_opened(project):\n'
' project.root.create_file("loaded")\n')
self.project.close()
self.project = Project(self.project.address, ropefolder='.ropeproject')
self.assertTrue(self.project.get_file('loaded').exists())
myfile = self.project.get_file('myfile.txt')
self.assertTrue(self.project.is_ignored(myfile))
def test_ignoring_syntax_errors(self):
self.project = testutils.sample_project(ropefolder=None,
ignore_syntax_errors=True)
mod = testutils.create_module(self.project, 'mod')
mod.write('xyz print')
pymod = self.project.get_pymodule(mod) # noqa
def test_compressed_history(self):
self.project = testutils.sample_project(compress_history=True)
mod = testutils.create_module(self.project, 'mod')
mod.write('')
def test_compressed_objectdb(self):
self.project = testutils.sample_project(compress_objectdb=True)
mod = testutils.create_module(self.project, 'mod')
self.project.pycore.analyze_module(mod)
def test_nested_dot_ropeproject_folder(self):
self.project = testutils.sample_project(ropefolder='.f1/f2')
ropefolder = self.project.ropefolder
self.assertEquals('.f1/f2', ropefolder.path)
self.assertTrue(ropefolder.exists())