コード例 #1
0
ファイル: test_files.py プロジェクト: ziadsawalha/coveragepy
 def test_module_matcher(self):
     matches_to_try = [
         ('test', True),
         ('trash', False),
         ('testing', False),
         ('test.x', True),
         ('test.x.y.z', True),
         ('py', False),
         ('py.t', False),
         ('py.test', True),
         ('py.testing', False),
         ('py.test.buz', True),
         ('py.test.buz.baz', True),
         ('__main__', False),
         ('mymain', True),
         ('yourmain', False),
     ]
     modules = ['test', 'py.test', 'mymain']
     mm = ModuleMatcher(modules)
     self.assertEqual(
         mm.info(),
         modules
     )
     for modulename, matches in matches_to_try:
         self.assertEqual(
             mm.match(modulename),
             matches,
             modulename,
         )
コード例 #2
0
 def test_module_matcher(self):
     matches_to_try = [
         ('test', True),
         ('trash', False),
         ('testing', False),
         ('test.x', True),
         ('test.x.y.z', True),
         ('py', False),
         ('py.t', False),
         ('py.test', True),
         ('py.testing', False),
         ('py.test.buz', True),
         ('py.test.buz.baz', True),
         ('__main__', False),
         ('mymain', True),
         ('yourmain', False),
     ]
     modules = ['test', 'py.test', 'mymain']
     mm = ModuleMatcher(modules)
     self.assertEqual(mm.info(), modules)
     for modulename, matches in matches_to_try:
         self.assertEqual(
             mm.match(modulename),
             matches,
             modulename,
         )