----- Original Message -----
> From: Ethan Furman <et...@stoneleaf.us> > To: Albert-Jan Roskam <fo...@yahoo.com> > Cc: "python-list@python.org" <python-list@python.org> > Sent: Tuesday, November 11, 2014 10:15 PM > Subject: Re: I love assert > > On 11/11/2014 01:09 PM, Albert-Jan Roskam wrote: >> Ethan Furman wrote: >>> >>> asserts are a specialized tool, easily abused. Sounds like you are > using them >>> exactly as intended. >> >> Would you say that assert is baaadly abused in nose?*) I never tried it, > but >> probably all tests pass when Python is run with -O or -OO. > > I don't know, haven't used it nor read the code. It would certainly not > be good if it failed in optimized mode. antonia@antonia-HP-2133 /tmp $ cat test.py def test_func_1(): assert 1 == 2 def test_func_2(): x = 1; y = 2 assert x == y if __name__ == "__main__": import nose nose.main() antonia@antonia-HP-2133 /tmp $ python -O test.py .. ---------------------------------------------------------------------- Ran 2 tests in 0.015s OK antonia@antonia-HP-2133 /tmp $ python -O -m nose test.py .. ---------------------------------------------------------------------- Ran 2 tests in 0.003s OK antonia@antonia-HP-2133 /tmp $ python test.py FF ====================================================================== FAIL: test.test_func_1 ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/nose/case.py", line 197, in runTest self.test(*self.arg) File "/tmp/test.py", line 2, in test_func_1 assert 1 == 2 AssertionError ====================================================================== FAIL: test.test_func_2 ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/nose/case.py", line 197, in runTest self.test(*self.arg) File "/tmp/test.py", line 6, in test_func_2 assert x == y AssertionError ---------------------------------------------------------------------- Ran 2 tests in 0.044s FAILED (failures=2) antonia@antonia-HP-2133 /tmp $ python -m nose test.py ... (same as previous) antonia@antonia-HP-2133 /tmp $ nosetests -O -v test.py Usage: nosetests [options] nosetests: error: no such option: -O # phweeew -- https://mail.python.org/mailman/listinfo/python-list