Skip to content

Tag: python-unittest

Python unittest AssertionError: 0 != []

I’m new to Python unittest and I’m trying to access this list: to do this test: I’ve created this function: But I keep getting this error: AssertionError: 0 != [] Can someone help explain what I’m doing wrong in the function please? Answer Let’s take a look at this part, the get_…

Python Unittest Allow Multiple Possible Return Values

I’m writing a unittest that will be run on my class’s code. For one of the functions they must write, there are two possible return values that they could return and either one is okay for my purposes. I’ve been using But this doesn’t work for accepting one of two valid return values, …