What is the best way to do assertEqual with unittest in Python, but instead of testing == it tests is? I want to ensure I have the same object, not just objects that compare equal. This is important, because some of the objects I'm working with are heap types with wacky compare operators.
That would be the assertIs method.
Use assertIs which does exactly what you want.
https://docs.python.org/3/library/unittest.html#unittest.TestCase.assertIs
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With