Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

assertListEqual negation (opposite)

There are functions: assertSequenceEqual, assertListEqual and assertTupleEqual in unittest module.

But how can I achive the opposite behavior? How can I assert that lists are unequal?

like image 428
kharandziuk Avatar asked Mar 18 '23 22:03

kharandziuk


1 Answers

Those functions are actually used by TestCase.assertEqual(), when both values are the same type and a type-specific method is present.

The inverse is simply to use TestCase.assertNotEqual().

There are no nice 'formatting' options in that case, but if the test fails, that'd means that both lists were equal, so there is no point in showing how they match exactly!

like image 87
Martijn Pieters Avatar answered Mar 23 '23 05:03

Martijn Pieters