我正在
django
中测试我的代码,我有一个案例,我想测试它是否is NOT equal
。
我该怎么做?
我正在使用来自
django
的文档:
https://docs.djangoproject.com/fr/2.2/topics/testing/tools/
React
中的另一个例子,我们有.not
表示不等于。
我尝试过
.not
class SimpleTest(TestCase):
def test_details(self):
response = self.client.get('/customer/details/')
self.assertEqual(response.status_code, 200).not()
我预计会有一个条件,即测试
not equality between my variable and my status code.
@DanielRoseman 的解决方案正在运行。 使用assertNotEqual解决了问题
文档:https://docs.python.org/3/library/unittest.html#unittest.TestCase.assertNotEqual