Method name doesn't conform to snake_case naming style

user1050619 picture user1050619 · May 20, 2018 · Viewed 45.6k times · Source

I’m creating a simple project with my pylintrc file and get this error for the test method:

method name - test_calculator_add_method_returns_correct_result -  doesn't conform to snake_case naming style
class TddInPythonExample(unittest.TestCase):
    """ This is a basic test class"""

    def test_calculator_add_method_returns_correct_result(self):
        """ This test the calculator add method """
        calc = Calculator()
        result = calc.add(2,2)
        self.assertEqual(4, result)

Answer

jrtapsell picture jrtapsell · May 20, 2018

Why is the method name rejected

It appears according to this: http://pylint-messages.wikidot.com/messages:c0103 that the length of the name is capped at 30 characters, where your method name is 49 characters long

The fix

You can shorten the method name, or change your config to allow longer methods