summaryrefslogtreecommitdiffstats
path: root/Lib/unittest/test
diff options
context:
space:
mode:
authorMichael Foord <fuzzyman@voidspace.org.uk>2011-01-03 17:00:11 (GMT)
committerMichael Foord <fuzzyman@voidspace.org.uk>2011-01-03 17:00:11 (GMT)
commit32e1d8340c05fa62ba51dbd942bdc09a21e65f6e (patch)
tree4523249e3c25efec0cc94a82a9392894282d3990 /Lib/unittest/test
parentfaa8c13ef43eda21a363524a7eb0ff1b361bbe67 (diff)
downloadcpython-32e1d8340c05fa62ba51dbd942bdc09a21e65f6e.zip
cpython-32e1d8340c05fa62ba51dbd942bdc09a21e65f6e.tar.gz
cpython-32e1d8340c05fa62ba51dbd942bdc09a21e65f6e.tar.bz2
Enable unittest.TestCase to be instantiated without providing a method name.
Changed unittestgui to show number of discovered tests in the status bar.
Diffstat (limited to 'Lib/unittest/test')
-rw-r--r--Lib/unittest/test/test_case.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/unittest/test/test_case.py b/Lib/unittest/test/test_case.py
index 9a09dfa..1513fbe 100644
--- a/Lib/unittest/test/test_case.py
+++ b/Lib/unittest/test/test_case.py
@@ -77,6 +77,16 @@ class Test_TestCase(unittest.TestCase, TestEquality, TestHashing):
self.assertEqual(Test().id()[-13:], '.Test.runTest')
+ # test that TestCase can be instantiated with no args
+ # primarily for use at the interactive interpreter
+ test = unittest.TestCase()
+ test.assertEqual(3, 3)
+ with test.assertRaises(test.failureException):
+ test.assertEqual(3, 2)
+
+ with self.assertRaises(AttributeError):
+ test.run()
+
# "class TestCase([methodName])"
# ...
# "Each instance of TestCase will run a single test method: the