Closed
Description
In python !=
and is not
are two different things.
Right now the deprecation warning says !=
, let's see if that's true:
from unittest import TestCase, main
class Nothing:
def __eq__(self, o):
return o is None
class TestExample(TestCase):
def test_method(self):
n = Nothing()
self.assertEqual(n, None)
return n
main()
It still raises this:
/Users/sobolev/Desktop/cpython/Lib/unittest/case.py:678: DeprecationWarning: It is deprecated to return a value!=None from a test case (<bound method TestExample.test_method of <__main__.TestExample testMethod=test_method>>)
return self.run(*args, **kwds)
.
----------------------------------------------------------------------
Ran 1 test in 0.003s
OK
I believe that this is misleading. The proper message should say: It is deprecated to return a value that is not None from a test case
I will send a PR with the fix.