add a test for bad atexit arguments

This commit is contained in:
Benjamin Peterson 2008-09-23 03:14:49 +00:00
parent 711552bb40
commit b8401c7cb1
1 changed files with 4 additions and 0 deletions

View File

@ -44,6 +44,10 @@ class TestCase(unittest.TestCase):
self.assertEqual(self.stream.getvalue(),
"h4 (4,) {'kw': 'abc'}\nh4 () {}\nh1\n")
def test_badargs(self):
atexit.register(lambda: 1, 0, 0, (x for x in (1,2)), 0, 0)
self.assertRaises(TypeError, atexit._run_exitfuncs)
def test_order(self):
# be sure handlers are executed in reverse order
atexit.register(h1)