[Python-checkins] python/dist/src/Lib unittest.py,1.19,1.20
gvanrossum@users.sourceforge.net
gvanrossum@users.sourceforge.net
Mon, 30 Sep 2002 12:25:58 -0700
Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv15454
Modified Files:
unittest.py
Log Message:
Now that TestCase is a new-style class, change loadTestsFromModule and
loadTestsFromName to accept new-style classes too!
Index: unittest.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/unittest.py,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** unittest.py 13 Aug 2002 20:43:46 -0000 1.19
--- unittest.py 30 Sep 2002 19:25:56 -0000 1.20
***************
*** 423,427 ****
for name in dir(module):
obj = getattr(module, name)
! if type(obj) == types.ClassType and issubclass(obj, TestCase):
tests.append(self.loadTestsFromTestCase(obj))
return self.suiteClass(tests)
--- 423,428 ----
for name in dir(module):
obj = getattr(module, name)
! if (isinstance(obj, (type, types.ClassType)) and
! issubclass(obj, TestCase)):
tests.append(self.loadTestsFromTestCase(obj))
return self.suiteClass(tests)
***************
*** 457,461 ****
if type(obj) == types.ModuleType:
return self.loadTestsFromModule(obj)
! elif type(obj) == types.ClassType and issubclass(obj, unittest.TestCase):
return self.loadTestsFromTestCase(obj)
elif type(obj) == types.UnboundMethodType:
--- 458,463 ----
if type(obj) == types.ModuleType:
return self.loadTestsFromModule(obj)
! elif (isinstance(obj, (type, types.ClassType)) and
! issubclass(obj, unittest.TestCase)):
return self.loadTestsFromTestCase(obj)
elif type(obj) == types.UnboundMethodType: