Problem understanding some unit tests in Python distribution
André
andre.roberge at gmail.com
Fri Apr 3 22:39:31 EDT 2009
Hi everyone,
In the hope of perhaps contributing some additional unit tests for
Python (thus contributing back to the community), I dove in the code
and found something that should be simple but that I can not wrap my
head around.
In list_tests.py, one finds
===
from test import test_support, seq_tests
class CommonTest(seq_tests.CommonTest):
def test_init(self):
# Iterable arg is optional
self.assertEqual(self.type2test([]), self.type2test())
# etc.
===
Wanting to figure out what the type2test() method does, I looked in
seq_tests.py and found the following:
===
class CommonTest(unittest.TestCase):
# The type to be tested
type2test = None
def test_constructors(self):
l0 = []
l1 = [0]
l2 = [0, 1]
u = self.type2test()
u0 = self.type2test(l0)
u1 = self.type2test(l1)
u2 = self.type2test(l2)
# etc.
===
No where do I find a definition for the type2test() method - other
than seeing it as a class variable defined to be None by default. I
looked in unittest.TestCase and did not see it anywhere.
Am I missing something obvious? I would appreciate if someone could
point me in the right direction.
Cheers,
André
More information about the Python-list
mailing list