1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
Before:
runtime ale_linters/python/vulture.vim
call ale#test#SetDirectory('/testplugin/test/handler')
After:
Restore
call ale#test#RestoreDirectory()
call ale#linter#Reset()
silent file something_else.py
Execute(Basic vulture check with relative path in result should be handled):
call ale#test#SetFilename('something_else.py')
AssertEqual
\ [
\ {
\ 'lnum': 34,
\ 'text': 'unused variable ''foo'' (60% confidence)',
\ 'type': 'W',
\ 'filename': ale#path#Simplify(g:dir . '/something_else.py'),
\ },
\ ],
\ ale_linters#python#vulture#Handle(bufnr(''), [
\ './something_else.py:34: unused variable ''foo'' (60% confidence)',
\ ])
Execute(Basic vulture check with absolute path in result should be handled):
call ale#test#SetFilename('something_else.py')
AssertEqual
\ [
\ {
\ 'lnum': 34,
\ 'text': 'unused variable ''foo'' (60% confidence)',
\ 'type': 'W',
\ 'filename': ale#path#Simplify(g:dir . '/something_else.py'),
\ },
\ ],
\ ale_linters#python#vulture#Handle(bufnr(''), [
\ ale#path#Simplify(g:dir . '/something_else.py') . ':34: unused variable ''foo'' (60% confidence)',
\ ])
Execute(Vulture check for two files should be handled):
call ale#test#SetFilename('something_else.py')
AssertEqual
\ [
\ {
\ 'lnum': 34,
\ 'text': 'unused variable ''foo'' (60% confidence)',
\ 'type': 'W',
\ 'filename': ale#path#Simplify(g:dir . '/something_else.py'),
\ },
\ {
\ 'lnum': 12,
\ 'text': 'unused variable ''bar'' (60% confidence)',
\ 'type': 'W',
\ 'filename': ale#path#Simplify(g:dir . '/second_one.py'),
\ },
\ ],
\ ale_linters#python#vulture#Handle(bufnr(''), [
\ './something_else.py:34: unused variable ''foo'' (60% confidence)',
\ './second_one.py:12: unused variable ''bar'' (60% confidence)',
\ ])
Execute(Vulture exception should be handled):
call ale#test#SetFilename('something_else.py')
AssertEqual
\ [
\ {
\ 'lnum': 1,
\ 'text': 'BaddestException: Everything gone wrong (See :ALEDetail)',
\ 'detail': join([
\ 'Traceback (most recent call last):',
\ ' File "/usr/lib/python3.6/site-packages/vulture/__init__.py", line 13, in <module>',
\ ' from .core import stuff',
\ 'BaddestException: Everything gone wrong',
\ ], "\n"),
\ }
\ ],
\ ale_linters#python#vulture#Handle(bufnr(''), [
\ 'Traceback (most recent call last):',
\ ' File "/usr/lib/python3.6/site-packages/vulture/__init__.py", line 13, in <module>',
\ ' from .core import stuff',
\ 'BaddestException: Everything gone wrong',
\ ])
Execute(The vulture handler should handle empty output):
AssertEqual
\ [],
\ ale_linters#python#vulture#Handle(bufnr(''), [])
|