]> granicus.if.org Git - python/commitdiff
Topical change: use 'startswith()' to identify test methods with a
authorSteve Purcell <steve@pythonconsulting.com>
Tue, 23 Sep 2003 08:41:53 +0000 (08:41 +0000)
committerSteve Purcell <steve@pythonconsulting.com>
Tue, 23 Sep 2003 08:41:53 +0000 (08:41 +0000)
given prefix rather than comparing a slice.

Lib/unittest.py

index f44769e9261d5e93dbd1496c70de7a7a3db459c9..56c6da5d3ccb15ef01ddf11e822803b9d95f445c 100644 (file)
@@ -46,7 +46,7 @@ SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 
 __author__ = "Steve Purcell"
 __email__ = "stephen_purcell at yahoo dot com"
-__version__ = "#Revision: 1.56 $"[11:-2]
+__version__ = "#Revision: 1.57 $"[11:-2]
 
 import time
 import sys
@@ -540,7 +540,7 @@ class TestLoader:
         """Return a sorted sequence of method names found within testCaseClass
         """
         def isTestMethod(attrname, testCaseClass=testCaseClass, prefix=self.testMethodPrefix):
-            return attrname[:len(prefix)] == prefix and callable(getattr(testCaseClass, attrname))
+            return attrname.startswith(prefix) and callable(getattr(testCaseClass, attrname))
         testFnNames = filter(isTestMethod, dir(testCaseClass))
         for baseclass in testCaseClass.__bases__:
             for testFnName in self.getTestCaseNames(baseclass):