From 31fd7c335f325f4081449bc08b5b86aabaa98c6d Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Wed, 28 Jun 2017 10:28:27 +0200 Subject: [PATCH] Fixed 231 issues. --- parso/python/normalizer.py | 5 ++--- test/normalizer_issue_files/E23.py | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 test/normalizer_issue_files/E23.py diff --git a/parso/python/normalizer.py b/parso/python/normalizer.py index 938669f..2c20ef8 100644 --- a/parso/python/normalizer.py +++ b/parso/python/normalizer.py @@ -474,10 +474,9 @@ class PEP8Normalizer(Normalizer): and leaf.parent.type not in ('subscript', 'subscriptlist'): message = "Whitespace before '%s'" % leaf.value add_if_spaces(203, message, info.indentation_part) - elif leaf == ':': # Is a subscript - # TODO - pass elif prev in (',', ';', ':'): + add_not_spaces('231', "missing whitespace after '%s'", info.indentation_part) + elif leaf == ':': # Is a subscript # TODO pass elif leaf in ('*', '**') and leaf.parent.type not in _NON_STAR_TYPES \ diff --git a/test/normalizer_issue_files/E23.py b/test/normalizer_issue_files/E23.py new file mode 100644 index 0000000..47f1447 --- /dev/null +++ b/test/normalizer_issue_files/E23.py @@ -0,0 +1,16 @@ +#: E231:7 +a = (1,2) +#: E231:5 +a[b1,:] +#: E231:10 +a = [{'a':''}] +# Okay +a = (4,) +#: E202:7 +b = (5, ) +c = {'text': text[5:]} + +result = { + 'key1': 'value', + 'key2': 'value', +}