diff options
Diffstat (limited to 'test/fixers/test_autoimport_fixer_callback.vader')
-rw-r--r-- | test/fixers/test_autoimport_fixer_callback.vader | 46 |
1 files changed, 38 insertions, 8 deletions
diff --git a/test/fixers/test_autoimport_fixer_callback.vader b/test/fixers/test_autoimport_fixer_callback.vader index edca5c38..785f4f65 100644 --- a/test/fixers/test_autoimport_fixer_callback.vader +++ b/test/fixers/test_autoimport_fixer_callback.vader @@ -18,11 +18,8 @@ After: call ale#test#RestoreDirectory() Execute(The autoimport callback should return the correct default values): - AssertEqual - \ 0, - \ ale#fixers#autoimport#Fix(bufnr('')) - silent execute 'file ' . fnameescape(g:dir . '/../test-files/python/with_virtualenv/subdir/foo/bar.py') + AssertEqual \ { \ 'cwd': '%s:h', @@ -33,11 +30,8 @@ Execute(The autoimport callback should return the correct default values): Execute(The autoimport callback should respect custom options): let g:ale_python_autoimport_options = '--multi-line=3 --trailing-comma' - AssertEqual - \ 0, - \ ale#fixers#autoimport#Fix(bufnr('')) - silent execute 'file ' . fnameescape(g:dir . '/../test-files/python/with_virtualenv/subdir/foo/bar.py') + AssertEqual \ { \ 'cwd': '%s:h', @@ -45,3 +39,39 @@ Execute(The autoimport callback should respect custom options): \ . ' --multi-line=3 --trailing-comma -', \ }, \ ale#fixers#autoimport#Fix(bufnr('')) + +Execute(pipenv is detected when python_autoimport_auto_pipenv is set): + let g:ale_python_autoimport_auto_pipenv = 1 + + call ale#test#SetFilename('../test-files/python/pipenv/whatever.py') + + AssertEqual + \ { + \ 'cwd': '%s:h', + \ 'command': ale#Escape('pipenv') . ' run autoimport -', + \ }, + \ ale#fixers#autoimport#Fix(bufnr('')) + +Execute(Poetry is detected when python_autoimport_auto_poetry is set): + let g:ale_python_autoimport_auto_poetry = 1 + + call ale#test#SetFilename('../test-files/python/poetry/whatever.py') + + AssertEqual + \ { + \ 'cwd': '%s:h', + \ 'command': ale#Escape('poetry') . ' run autoimport -', + \ }, + \ ale#fixers#autoimport#Fix(bufnr('')) + +Execute(uv is detected when python_autoimport_auto_uv is set): + let g:ale_python_autoimport_auto_uv = 1 + + call ale#test#SetFilename('../test-files/python/uv/whatever.py') + + AssertEqual + \ { + \ 'cwd': '%s:h', + \ 'command': ale#Escape('uv') . ' run autoimport -', + \ }, + \ ale#fixers#autoimport#Fix(bufnr('')) |