[Python-checkins] r52500 - python/trunk/Lib/test/test_grammar.py

Nick Coghlan ncoghlan at gmail.com
Sun Oct 29 02:43:55 CET 2006


georg.brandl wrote:
> Author: georg.brandl
> Date: Sat Oct 28 22:25:09 2006
> New Revision: 52500
> 
> Modified:
>    python/trunk/Lib/test/test_grammar.py
> Log:
> make test_grammar pass with python -O
> 
> 
> Modified: python/trunk/Lib/test/test_grammar.py
> ==============================================================================
> --- python/trunk/Lib/test/test_grammar.py	(original)
> +++ python/trunk/Lib/test/test_grammar.py	Sat Oct 28 22:25:09 2006
> @@ -544,8 +544,10 @@
>              assert 0, "msg"
>          except AssertionError, e:
>              self.assertEquals(e.args[0], "msg")
> -        else:
> -            self.fail("AssertionError not raised by assert 0")
> +        # we can not expect an assertion error to be raised
> +        # if the tests are run in an optimized python
> +        #else:
> +        #    self.fail("AssertionError not raised by assert 0")

Wouldn't a __debug__ check be a better option here, instead of commenting the 
test out completely?:

         else:
             # we cannot expect an assertion error to be raised
             # if the tests are run in an optimized python
             if __debug__:
                 self.fail("AssertionError not raised by assert 0")

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
---------------------------------------------------------------
             http://www.boredomandlaziness.org


More information about the Python-checkins mailing list