Index: Lib/test/test_grammar.py =================================================================== --- Lib/test/test_grammar.py (revision 80323) +++ Lib/test/test_grammar.py (working copy) @@ -486,7 +486,8 @@ def f(): nonlocal x nonlocal x, y - + + @unittest.skipUnless(__debug__, "Won't work and is irrelevant if __debug__ is False") def testAssert(self): # assertTruestmt: 'assert' test [',' test] assert 1 @@ -496,11 +497,28 @@ try: assert 0, "msg" except AssertionError as e: + self.assertEqual(len(e.args), 1) self.assertEqual(e.args[0], "msg") else: - if __debug__: - self.fail("AssertionError not raised by assert 0") + self.fail("AssertionError not raised by assert 0 with message") + + try: + assert False + except AssertionError as e: + self.assertEqual(len(e.args), 0) + else: + self.fail("AssertionError not raised by 'assert False'") + + try: + assert True + except AssertionError as e: + self.fail("'assert True' should not have raised an AssertionError") + try: + assert True, 'this should always pass' + except AssertionError as e: + self.fail("'assert True, msg' should not have raised an AssertionError") + ### compound_stmt: if_stmt | while_stmt | for_stmt | try_stmt | funcdef | classdef # Tested below