Django Unittest: Typeerror: 'nonetype' Object Is Not Iterable
python3 manage.py test apps.favorites Traceback (most recent call last): File 'manage.py', line 10, in execute_from_command_line(sys.argv) File '/home/dmitry
Solution 1:
This usually happens when you expect a list (or other sequence) returned from a function, but get an empty result of None
. If you then give this supposed list to something that requires iteration, such as a simple for
loop, you get the error shown. For instance:
>>> oops = None
>>> for i in oops:
... print i
...
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'NoneType' object is not iterable
Post a Comment for "Django Unittest: Typeerror: 'nonetype' Object Is Not Iterable"