C. Titus Brown schrieb:
Sorry for the second message, but... let's compare:
test_sort.py:
#! /usr/bin/env python
import unittest
class Test(unittest.TestCase):
def test_me(self):
seq = [ 5, 4, 1, 3, 2 ]
seq.sort()
self.assertEqual(seq, [1, 2, 3, 4, 5])
if __name__ == '__main__':
unittest.main()
with
test_sort2.py :
def test_me():
seq = [ 5, 4, 1, 3 2 ]
seq.sort()
assert seq == [1, 2, 3, 4, 5]
The *only value* that unittest adds here is in the 'assertEqual'
statement, which (I think) returns a richer error message than 'assert'.
If you use py.test, it does some magic to find out your test is an
equality comparison and displays both operands' repr(). Don't know about
nose.
Georg
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com