redundant-unittest-assert / W1503#
Redundant use of %s with constant value %r
The first argument of assertTrue and assertFalse is a condition. If a constant is passed as parameter, that condition will be always true. In this case a warning should be emitted.
import unittest class DummyTestCase(unittest.TestCase): def test_dummy(self): actual = "test_result" self.assertEqual(actual, "expected")
import unittest class DummyTestCase(unittest.TestCase): def test_dummy(self): self.assertTrue("foo") # [redundant-unittest-assert]
Directly asserting a string literal will always pass. The solution is to test something that could fail, or not assert at all.
Created by the stdlib checker.