redundant-unittest-assert / W1503ΒΆ
Message emitted:
Redundant use of %s with constant value %r
Description:
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.
Correct code:
import unittest
class DummyTestCase(unittest.TestCase):
def test_dummy(self):
# Nothing, as an assert of a string literal will always pass
Problematic code:
import unittest
class DummyTestCase(unittest.TestCase):
def test_dummy(self):
self.assertTrue("foo") # [redundant-unittest-assert]
Created by stdlib
checker