pythonpylintpylintrc

Method name doesn't conform to snake_case naming style


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)

Solution

  • Why is the method name rejected

    It appears according to this: (Link removed) 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