summaryrefslogtreecommitdiffstats
path: root/Lib/unittest.py
diff options
context:
space:
mode:
authorSteve Purcell <steve@pythonconsulting.com>2003-09-23 08:41:53 (GMT)
committerSteve Purcell <steve@pythonconsulting.com>2003-09-23 08:41:53 (GMT)
commit3198275acef08b4fc7ea8939ed91105f50148e1e (patch)
treed881551e356be872a9e08d1d9d21daecc95a7cd9 /Lib/unittest.py
parent09fad27a29419b4f86478ba363676eb147463384 (diff)
downloadcpython-3198275acef08b4fc7ea8939ed91105f50148e1e.zip
cpython-3198275acef08b4fc7ea8939ed91105f50148e1e.tar.gz
cpython-3198275acef08b4fc7ea8939ed91105f50148e1e.tar.bz2
Topical change: use 'startswith()' to identify test methods with a
given prefix rather than comparing a slice.
Diffstat (limited to 'Lib/unittest.py')
-rw-r--r--Lib/unittest.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/unittest.py b/Lib/unittest.py
index f44769e..56c6da5 100644
--- a/Lib/unittest.py
+++ b/Lib/unittest.py
@@ -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):