]> git.madduck.net Git - etc/vim.git/blob - .vim/bundle/ale/test/fixers/test_autopep8_fixer_callback.vader

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Merge commit '294584081929424aec883f90c7d6515b3743358d' as '.vim/bundle/vim-lsp-ale'
[etc/vim.git] / .vim / bundle / ale / test / fixers / test_autopep8_fixer_callback.vader
1 Before:
2   Save g:ale_python_autopep8_executable
3   Save g:ale_python_autopep8_options
4
5   " Use an invalid global executable, so we don't match it.
6   let g:ale_python_autopep8_executable = 'xxxinvalid'
7   let g:ale_python_autopep8_options = ''
8
9   call ale#test#SetDirectory('/testplugin/test/fixers')
10   let g:dir = getcwd()
11
12   let b:bin_dir = has('win32') ? 'Scripts' : 'bin'
13
14 After:
15   Restore
16
17   unlet! b:bin_dir
18
19   call ale#test#RestoreDirectory()
20
21 Execute(The autopep8 callback should return the correct default values):
22   silent execute 'file ' . fnameescape(g:dir . '/../test-files/python/with_virtualenv/subdir/foo/bar.py')
23
24   AssertEqual
25   \ {'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/autopep8')) . ' -'},
26   \ ale#fixers#autopep8#Fix(bufnr(''))
27
28 Execute(The autopep8 callback should include options):
29   let g:ale_python_autopep8_options = '--some-option'
30
31   silent execute 'file ' . fnameescape(g:dir . '/../test-files/python/with_virtualenv/subdir/foo/bar.py')
32
33   AssertEqual
34   \ {'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/autopep8')) . ' --some-option -' },
35   \ ale#fixers#autopep8#Fix(bufnr(''))
36
37 Execute(pipenv is detected when python_autopep8_auto_pipenv is set):
38   let g:ale_python_autopep8_auto_pipenv = 1
39
40   call ale#test#SetFilename('../test-files/python/pipenv/whatever.py')
41
42   AssertEqual
43   \ {
44   \   'command': ale#Escape('pipenv') . ' run autopep8 -',
45   \ },
46   \ ale#fixers#autopep8#Fix(bufnr(''))
47
48 Execute(Poetry is detected when python_autopep8_auto_poetry is set):
49   let g:ale_python_autopep8_auto_poetry = 1
50
51   call ale#test#SetFilename('../test-files/python/poetry/whatever.py')
52
53   AssertEqual
54   \ {
55   \   'command': ale#Escape('poetry') . ' run autopep8 -',
56   \ },
57   \ ale#fixers#autopep8#Fix(bufnr(''))
58
59 Execute(uv is detected when python_autopep8_auto_uv is set):
60   let g:ale_python_autopep8_auto_uv = 1
61
62   call ale#test#SetFilename('../test-files/python/uv/whatever.py')
63
64   AssertEqual
65   \ {
66   \   'command': ale#Escape('uv') . ' run autopep8 -',
67   \ },
68   \ ale#fixers#autopep8#Fix(bufnr(''))