88DOC_URI = uris .from_fs_path (__file__ )
99DOC = """import sys
1010
11- def hello():
11+ def hello( ):
1212\t pass
1313
1414import json
@@ -40,6 +40,14 @@ def test_pycodestyle(config):
4040 assert mod_import ['range' ]['start' ] == {'line' : 7 , 'character' : 0 }
4141 assert mod_import ['range' ]['end' ] == {'line' : 7 , 'character' : 1 }
4242
43+ msg = "E201 whitespace after '('"
44+ mod_import = [d for d in diags if d ['message' ] == msg ][0 ]
45+
46+ assert mod_import ['code' ] == 'E201'
47+ assert mod_import ['severity' ] == lsp .DiagnosticSeverity .Warning
48+ assert mod_import ['range' ]['start' ] == {'line' : 2 , 'character' : 10 }
49+ assert mod_import ['range' ]['end' ] == {'line' : 2 , 'character' : 14 }
50+
4351
4452def test_pycodestyle_config (workspace ):
4553 """ Test that we load config files properly.
@@ -66,7 +74,7 @@ def test_pycodestyle_config(workspace):
6674 assert [d for d in diags if d ['code' ] == 'W191' ]
6775
6876 content = {
69- 'setup.cfg' : ('[pycodestyle]\n ignore = W191' , True ),
77+ 'setup.cfg' : ('[pycodestyle]\n ignore = W191, E201 ' , True ),
7078 'tox.ini' : ('' , False )
7179 }
7280
@@ -77,18 +85,16 @@ def test_pycodestyle_config(workspace):
7785
7886 # And make sure we don't get any warnings
7987 diags = pycodestyle_lint .pyls_lint (config , doc )
80- assert len ([d for d in diags if d ['code' ] == 'W191' ]) == 0 if working else 1
88+ assert len ([d for d in diags if d ['code' ] == 'W191' ]) == (0 if working else 1 )
89+ assert len ([d for d in diags if d ['code' ] == 'E201' ]) == (0 if working else 1 )
90+ assert [d for d in diags if d ['code' ] == 'W391' ]
8191
8292 os .unlink (os .path .join (workspace .root_path , conf_file ))
8393
8494 # Make sure we can ignore via the PYLS config as well
85- config .update ({'plugins' : {'pycodestyle' : {'ignore' : ['W191' ]}}})
95+ config .update ({'plugins' : {'pycodestyle' : {'ignore' : ['W191' , 'E201' ]}}})
8696 # And make sure we only get one warning
8797 diags = pycodestyle_lint .pyls_lint (config , doc )
8898 assert not [d for d in diags if d ['code' ] == 'W191' ]
89-
90- # Ignore both warnings
91- config .update ({'plugins' : {'pycodestyle' : {'ignore' : ['W191' , 'W391' ]}}})
92- # And make sure we get neither
93- assert not [d for d in diags if d ['code' ] == 'W191' ]
94- assert not [d for d in diags if d ['code' ] == 'W391' ]
99+ assert not [d for d in diags if d ['code' ] == 'E201' ]
100+ assert [d for d in diags if d ['code' ] == 'W391' ]
0 commit comments