Help with unittest2

Paul Rudin paul.nospam at rudin.co.uk
Thu Dec 13 11:25:28 EST 2012


Thomas Bach <thbach at students.uni-mainz.de> writes:


> BTW, I actually never used 'assertTypeEqual' I rather call assertEqual
> and let unittest do the internals. I think assertEqual calls the right
> method for you depending on the arguments type. 


The assert<Type>Equal methods have the advantage of checking the type of
the arguments. assertEqual would be OK with equal numerical arguments,
but that would be an inferior test if you were really expecting two
lists.

> If you want to make sure that something is of a certain type use
> assertIsInstance!

Yes, but why do something in 3 lines when there's a perfectly good
method provided that allows you do to it directly in one?




More information about the Python-list mailing list