PyCharm errors for valid python code

179 views Asked by At

I posted the following question regarding nose and parameterized tests:

use-class-method-in-nose-parameterize.expand call

and I got my answer, but now I wonder why PyCharm is failing to recognize this as valid code. Does anyone know how to turn off this warning in Pycharm, or should i submit this as a bug to jet brains?

Here is what I know works, but PyCharm provides false negative error messages:

class MyUnitTestClass(TestCase):
  def generate_scenarios():
    yield ('this_is_my_test', 1, 2)

  @parameterized.expand(generate_scenarios())
  def test_scenario(self, test_name, input, expected_output):
    self.assertEquals(input+input, expected_output) 
1

There are 1 answers

6
Joran Beasley On

you can suppress anything you want in pycharm

  1. put the cursor right in between the parentheses (where it is underlined in red)
  2. press alt+enter to bring up suggestions
  3. press the right arrow key on the "Add self" line at the top of the suggestions
  4. select the option to suppress error

see also: https://www.jetbrains.com/pycharm/help/suppressing-inspections.html