Ensure the actual number matches the expected count

This commit is contained in:
Neal Norwitz 2006-07-28 04:22:34 +00:00
parent 641cddf0fa
commit df80af7659
1 changed files with 4 additions and 3 deletions

View File

@ -43,10 +43,11 @@ class IsTestBase(unittest.TestCase):
class TestPredicates(IsTestBase): class TestPredicates(IsTestBase):
def test_thirteen(self): def test_thirteen(self):
# Doc/lib/libinspect.tex claims there are 13 such functions
count = len(filter(lambda x:x.startswith('is'), dir(inspect))) count = len(filter(lambda x:x.startswith('is'), dir(inspect)))
self.assertEqual(count, 13, # Doc/lib/libinspect.tex claims there are 13 such functions
"There are %d (not 12) is* functions" % count) expected = 13
err_msg = "There are %d (not %d) is* functions" % (count, expected)
self.assertEqual(count, expected, err_msg)
def test_excluding_predicates(self): def test_excluding_predicates(self):
self.istest(inspect.isbuiltin, 'sys.exit') self.istest(inspect.isbuiltin, 'sys.exit')