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, )
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, )