summaryrefslogtreecommitdiff
path: root/test/functional/redundant_unittest_assert.py
blob: a8f6740857db92cd78ea5c2009111fd40dda6cc6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# pylint: disable=missing-docstring,too-few-public-methods
"""
http://www.logilab.org/ticket/355
If you are using assertTrue or assertFalse and the first argument is a
constant(like a string), then the assert will always be true. Therefore,
it should emit a warning message.
"""

import unittest


class Tests(unittest.TestCase):
    def test_something(self):
        ''' Simple test '''
        some_var = 'It should be assertEqual'
        # +1:[redundant-unittest-assert]
        self.assertTrue('I meant assertEqual not assertTrue', some_var)
        # +1:[redundant-unittest-assert]
        self.assertFalse('I meant assertEqual not assertFalse', some_var)