MCPcopy Index your code
hub / github.com/python/cpython / shouldIncludeMethod

Method shouldIncludeMethod

Lib/unittest/loader.py:213–223  ·  view source on GitHub ↗
(attrname)

Source from the content-addressed store, hash-verified

211 """Return a sorted sequence of method names found within testCaseClass
212 """
213 def shouldIncludeMethod(attrname):
214 if not attrname.startswith(self.testMethodPrefix):
215 return False
216 testFunc = getattr(testCaseClass, attrname)
217 if not callable(testFunc):
218 return False
219 fullName = f'%s.%s.%s' % (
220 testCaseClass.__module__, testCaseClass.__qualname__, attrname
221 )
222 return self.testNamePatterns is None or \
223 any(fnmatchcase(fullName, pattern) for pattern in self.testNamePatterns)
224 testFnNames = list(filter(shouldIncludeMethod, dir(testCaseClass)))
225 if self.sortTestMethodsUsing:
226 testFnNames.sort(key=functools.cmp_to_key(self.sortTestMethodsUsing))

Callers

nothing calls this directly

Calls 3

fnmatchcaseFunction · 0.90
anyFunction · 0.50
startswithMethod · 0.45

Tested by

no test coverage detected