Bruno Desthuilliers [EMAIL PROTECTED] writes:
http://codespeak.net/py/current/doc/test.html#assert-with-the-assert-statement
Ok, I didn't come across this before.
I didn't work for me though, even the simple case
#!/usr/bin/python
a = 1
b = 2
def test_some():
assert a == b
#!/usr/bin/python
a = 1
b = 2
def test_some():
assert a == b
didn't reveal the values for a and b, though some more complex cases
showed something.
def test_some():
print 'a:', a, 'b:', b
assert a == b
Jens Theisen [EMAIL PROTECTED] writes:
def test_some():
assert a == b
didn't reveal the values for a and b, though some more complex cases
showed something.
I usually use
assert a == b, (a,b)
--
http://mail.python.org/mailman/listinfo/python-list
That's hardly desirable. If one is writing a test library that goes as
far as reparsing the assert statements, I can't see the point of
requiring the user to clutter his test suite with such spurious print
statements. After all, that's one of the main points of test suites in
the first place
Hello,
I find it annoying that one has to write
self.assertEqual(x, y)
rather than just
assert x == y
when writing tests. This is a nuisance in all the programming
languages I know of (which are not too many). In Python however, there
appears to be a better alternative. The piece of code
Jens Theisen a écrit :
Hello,
I find it annoying that one has to write
self.assertEqual(x, y)
rather than just
assert x == y
when writing tests. This is a nuisance in all the programming
languages I know of (which are not too many).