本文整理汇总了Python中coverage.files.PathAliases.map方法的典型用法代码示例。如果您正苦于以下问题:Python PathAliases.map方法的具体用法?Python PathAliases.map怎么用?Python PathAliases.map使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类coverage.files.PathAliases
的用法示例。
在下文中一共展示了PathAliases.map方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_wildcard
# 需要导入模块: from coverage.files import PathAliases [as 别名]
# 或者: from coverage.files.PathAliases import map [as 别名]
def test_wildcard(self):
aliases = PathAliases()
aliases.add('/ned/home/*/src', './mysrc')
self.assertEqual(aliases.map('/ned/home/foo/src/a.py'), './mysrc/a.py')
aliases = PathAliases()
aliases.add('/ned/home/*/src/', './mysrc')
self.assertEqual(aliases.map('/ned/home/foo/src/a.py'), './mysrc/a.py')
示例2: test_paths_are_os_corrected
# 需要导入模块: from coverage.files import PathAliases [as 别名]
# 或者: from coverage.files.PathAliases import map [as 别名]
def test_paths_are_os_corrected(self):
aliases = PathAliases()
aliases.add('/home/ned/*/src', './mysrc')
aliases.add(r'c:\ned\src', './mysrc')
mapped = aliases.map(r'C:\Ned\src\sub\a.py')
self.assertEqual(mapped, './mysrc/sub/a.py')
aliases = PathAliases()
aliases.add('/home/ned/*/src', r'.\mysrc')
aliases.add(r'c:\ned\src', r'.\mysrc')
mapped = aliases.map(r'/home/ned/foo/src/sub/a.py')
self.assertEqual(mapped, r'.\mysrc\sub\a.py')
示例3: test_dot
# 需要导入模块: from coverage.files import PathAliases [as 别名]
# 或者: from coverage.files.PathAliases import map [as 别名]
def test_dot(self):
for d in ('.', '..', '../other', '~'):
aliases = PathAliases()
aliases.add(d, '/the/source')
the_file = os.path.join(d, 'a.py')
the_file = os.path.expanduser(the_file)
the_file = os.path.abspath(os.path.realpath(the_file))
assert '~' not in the_file # to be sure the test is pure.
self.assertEqual(aliases.map(the_file), '/the/source/a.py')
示例4: test_leading_wildcard
# 需要导入模块: from coverage.files import PathAliases [as 别名]
# 或者: from coverage.files.PathAliases import map [as 别名]
def test_leading_wildcard(self):
aliases = PathAliases()
aliases.add('*/d1', './mysrc1')
aliases.add('*/d2', './mysrc2')
self.assertEqual(aliases.map('/foo/bar/d1/x.py'), './mysrc1/x.py')
self.assertEqual(aliases.map('/foo/bar/d2/y.py'), './mysrc2/y.py')
示例5: test_no_accidental_munging
# 需要导入模块: from coverage.files import PathAliases [as 别名]
# 或者: from coverage.files.PathAliases import map [as 别名]
def test_no_accidental_munging(self):
aliases = PathAliases()
aliases.add(r'c:\Zoo\boo', 'src/')
aliases.add('/home/ned$', 'src/')
self.assertEqual(aliases.map(r'c:\Zoo\boo\foo.py'), 'src/foo.py')
self.assertEqual(aliases.map(r'/home/ned$/foo.py'), 'src/foo.py')
示例6: test_multiple_patterns
# 需要导入模块: from coverage.files import PathAliases [as 别名]
# 或者: from coverage.files.PathAliases import map [as 别名]
def test_multiple_patterns(self):
aliases = PathAliases()
aliases.add('/home/*/src', './mysrc')
aliases.add('/lib/*/libsrc', './mylib')
self.assertEqual(aliases.map('/home/foo/src/a.py'), './mysrc/a.py')
self.assertEqual(aliases.map('/lib/foo/libsrc/a.py'), './mylib/a.py')
示例7: test_no_accidental_match
# 需要导入模块: from coverage.files import PathAliases [as 别名]
# 或者: from coverage.files.PathAliases import map [as 别名]
def test_no_accidental_match(self):
aliases = PathAliases()
aliases.add('/home/*/src', './mysrc')
self.assertEqual(aliases.map('/home/foo/srcetc'), '/home/foo/srcetc')
示例8: test_nomatch
# 需要导入模块: from coverage.files import PathAliases [as 别名]
# 或者: from coverage.files.PathAliases import map [as 别名]
def test_nomatch(self):
aliases = PathAliases()
aliases.add('/home/*/src', './mysrc')
self.assertEqual(aliases.map('/home/foo/a.py'), '/home/foo/a.py')
示例9: test_noop
# 需要导入模块: from coverage.files import PathAliases [as 别名]
# 或者: from coverage.files.PathAliases import map [as 别名]
def test_noop(self):
aliases = PathAliases()
self.assertEqual(aliases.map('/ned/home/a.py'), '/ned/home/a.py')