diff options
author | Kevin Locke <kevin@kevinlocke.name> | 2019-02-08 21:44:34 +0000 |
---|---|---|
committer | w0rp <w0rp@users.noreply.github.com> | 2019-02-08 21:44:34 +0000 |
commit | a24f0b4d5f91f9214c64ae281fadcd981e0dadfc (patch) | |
tree | 25e07c98b5de66ab70db85b980fcbe9f3675358d /test/test_python_traceback.vader | |
parent | 422908a5721e11be73935b765f599f9fc672802e (diff) | |
download | ale-a24f0b4d5f91f9214c64ae281fadcd981e0dadfc.zip |
Support pylama for python (#2266)
* Add pylama for python
* Consolidate python traceback handling
Diffstat (limited to 'test/test_python_traceback.vader')
-rw-r--r-- | test/test_python_traceback.vader | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/test/test_python_traceback.vader b/test/test_python_traceback.vader new file mode 100644 index 00000000..6a659986 --- /dev/null +++ b/test/test_python_traceback.vader @@ -0,0 +1,79 @@ +Execute(ale#python#HandleTraceback returns empty List for empty lines): + AssertEqual + \ [], + \ ale#python#HandleTraceback([], 10) + +Execute(ale#python#HandleTraceback returns traceback, when present): + AssertEqual + \ [{ + \ 'lnum': 1, + \ 'text': 'Exception: Example error (See :ALEDetail)', + \ 'detail': join([ + \ 'Traceback (most recent call last):', + \ ' File "./example.py", line 5, in <module>', + \ ' raise Exception(''Example message'')', + \ 'Exception: Example error', + \ ], "\n"), + \ }], + \ ale#python#HandleTraceback([ + \ 'Traceback (most recent call last):', + \ ' File "./example.py", line 5, in <module>', + \ ' raise Exception(''Example message'')', + \ 'Exception: Example error', + \ ], 1) + +" SyntaxError has extra output lines about the source +Execute(ale#python#HandleTraceback returns SyntaxError traceback): + AssertEqual + \ [{ + \ 'lnum': 1, + \ 'text': 'SyntaxError: invalid syntax (See :ALEDetail)', + \ 'detail': join([ + \ 'Traceback (most recent call last):', + \ ' File "<string>", line 1, in <module>', + \ ' File "example.py", line 5', + \ ' +', + \ ' ^', + \ 'SyntaxError: invalid syntax', + \ ], "\n"), + \ }], + \ ale#python#HandleTraceback([ + \ 'Traceback (most recent call last):', + \ ' File "<string>", line 1, in <module>', + \ ' File "example.py", line 5', + \ ' +', + \ ' ^', + \ 'SyntaxError: invalid syntax', + \ ], 1) + +Execute(ale#python#HandleTraceback ignores traceback after line limit): + AssertEqual + \ [], + \ ale#python#HandleTraceback([ + \ '', + \ 'Traceback (most recent call last):', + \ ' File "./example.py", line 5, in <module>', + \ ' raise Exception(''Example message'')', + \ 'Exception: Example error', + \ ], 1) + +Execute(ale#python#HandleTraceback doesn't include later lines in detail): + AssertEqual + \ [{ + \ 'lnum': 1, + \ 'text': 'Exception: Example error (See :ALEDetail)', + \ 'detail': join([ + \ 'Traceback (most recent call last):', + \ ' File "./example.py", line 5, in <module>', + \ ' raise Exception(''Example message'')', + \ 'Exception: Example error', + \ ], "\n"), + \ }], + \ ale#python#HandleTraceback([ + \ 'Traceback (most recent call last):', + \ ' File "./example.py", line 5, in <module>', + \ ' raise Exception(''Example message'')', + \ 'Exception: Example error', + \ 'file:1:2: Style issue', + \ 'file:3:4: Non-style issue', + \ ], 1) |