Skip to content

Commit

Permalink
Add unit tests for W503-W504 ignores
Browse files Browse the repository at this point in the history
  • Loading branch information
novadev94 committed Feb 26, 2020
1 parent 8701bbc commit 690e746
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions test/test_autopep8.py
Expand Up @@ -4402,6 +4402,32 @@ def test_w503(self):
with autopep8_context(line, options=['--select=W503']) as result:
self.assertEqual(fixed, result)

def test_w503_with_ignore_w504(self):
line = '(width == 0\n + height == 0)\n'
fixed = '(width == 0 +\n height == 0)\n'
with autopep8_context(line, options=['--ignore=E,W504']) as result:
self.assertEqual(fixed, result)

def test_w504_with_ignore_w503(self):
line = '(width == 0 +\n height == 0)\n'
fixed = '(width == 0\n + height == 0)\n'
with autopep8_context(line, options=['--ignore=E,W503']) as result:
self.assertEqual(fixed, result)

def test_w503_w504_none_ignored(self):
line = '(width == 0 +\n height == 0\n+ depth == 0)\n'
fixed = '(width == 0 +\n height == 0\n+ depth == 0)\n'
with autopep8_context(line, options=['--ignore=E']) as result:
self.assertEqual(fixed, result)

def test_w503_w504_both_ignored(self):
line = '(width == 0 +\n height == 0\n+ depth == 0)\n'
fixed = '(width == 0 +\n height == 0\n+ depth == 0)\n'
with autopep8_context(
line, options=['--ignore=E,W503, W504'],
) as result:
self.assertEqual(fixed, result)

def test_w503_skip_default(self):
line = '(width == 0\n + height == 0)\n'
with autopep8_context(line) as result:
Expand Down

0 comments on commit 690e746

Please sign in to comment.