示例#1
0
 def test_selector_auto_unrelated(self):
     rule = AutoLineDisableRule()
     assert rule.regex_match_any(
         '# flake8: disable=E101 pylint: disable=E102', ['E101'],
     )
     assert not rule.regex_match_any(
         '# flake8: disable=E101 pylint: disable=E102', ['E102'],
     )
     assert rule.regex_match_any(
         '# pylint: disable=E102 flake8: disable=E101', ['E101'],
     )
     assert not rule.regex_match_any(
         '# pylint: disable=E102 flake8: disable=E101', ['E102'],
     )
示例#2
0
 def test_selector_auto_unrelated(self):
     rule = AutoLineDisableRule()
     assert rule.regex_match_any(
         '# flake8: disable=E101 pylint: disable=E102',
         ['E101'],
     )
     assert not rule.regex_match_any(
         '# flake8: disable=E101 pylint: disable=E102',
         ['E102'],
     )
     assert rule.regex_match_any(
         '# pylint: disable=E102 flake8: disable=E101',
         ['E101'],
     )
     assert not rule.regex_match_any(
         '# pylint: disable=E102 flake8: disable=E101',
         ['E102'],
     )
示例#3
0
 def test_selector_auto_multi(self):
     rule = AutoLineDisableRule()
     assert rule.regex_match_any('# flake8: disable=E101, E102', ['E101'])
     assert rule.regex_match_any('# flake8: disable=E101, E102', ['E102'])
     assert not rule.regex_match_any('# flake8: disable=E10', ['E102'])
示例#4
0
 def test_selector_auto_missing_code(self):
     rule = AutoLineDisableRule()
     assert not rule.regex_match_any('foo # flake8: disable=', ['E101'])
     assert not rule.regex_match_any('foo # flake8: disable=', ['E102'])
示例#5
0
 def test_selector_auto_multi(self):
     rule = AutoLineDisableRule()
     assert rule.regex_match_any('# flake8: disable=E101, E102', ['E101'])
     assert rule.regex_match_any('# flake8: disable=E101, E102', ['E102'])
     assert not rule.regex_match_any('# flake8: disable=E10', ['E102'])
示例#6
0
 def test_selector_auto_missing_code(self):
     rule = AutoLineDisableRule()
     assert not rule.regex_match_any('foo # flake8: disable=', ['E101'])
     assert not rule.regex_match_any('foo # flake8: disable=', ['E102'])