问题
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:
you can suppress anything you want in pycharm
- put the cursor right in between the parentheses (where it is underlined in red)
- press alt+enter to bring up suggestions
- press the right arrow key on the "Add self" line at the top of the suggestions
- select the option to suppress error
see also: https://www.jetbrains.com/pycharm/help/suppressing-inspections.html
来源:https://stackoverflow.com/questions/30943408/pycharm-errors-for-valid-python-code