]> git.madduck.net Git - etc/vim.git/blob - test/fixers/test_isort_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:

Squashed '.vim/bundle/ale/' content from commit 22185c4c
[etc/vim.git] / test / fixers / test_isort_fixer_callback.vader
1 Before:
2   call ale#assert#SetUpFixerTest('python', 'isort')
3
4   let b:bin_dir = has('win32') ? 'Scripts' : 'bin'
5
6 After:
7   call ale#assert#TearDownFixerTest()
8
9   unlet! g:dir
10   unlet! b:bin_dir
11
12 Execute(The isort callback should return the correct default values):
13   silent execute 'file ' . fnameescape(g:dir . '/../test-files/python/with_virtualenv/subdir/foo/bar.py')
14
15   " --filename option exists only after 5.7.0
16   GivenCommandOutput ['VERSION 5.7.0']
17   AssertFixer
18   \ {
19   \   'cwd': '%s:h',
20   \   'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/isort')) . ' --filename %s' . ' -',
21   \ }
22
23 Execute(The isort callback should respect custom options):
24   let g:ale_python_isort_options = '--multi-line=3 --trailing-comma'
25
26   silent execute 'file ' . fnameescape(g:dir . '/../test-files/python/with_virtualenv/subdir/foo/bar.py')
27
28   " --filename option exists only after 5.7.0
29   GivenCommandOutput ['VERSION 5.7.0']
30   AssertFixer
31   \ {
32   \   'cwd': '%s:h',
33   \   'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/isort'))
34   \     . ' --filename %s' . ' --multi-line=3 --trailing-comma -',
35   \ }
36
37 Execute(Pipenv is detected when python_isort_auto_pipenv is set):
38   let g:ale_python_isort_auto_pipenv = 1
39
40   call ale#test#SetFilename('../test-files/python/pipenv/whatever.py')
41
42   GivenCommandOutput ['VERSION 5.7.0']
43   AssertFixer
44   \ {
45   \   'cwd': '%s:h',
46   \   'command': ale#Escape('pipenv') . ' run isort' . ' --filename %s' . ' -'
47   \ }
48
49 Execute(Poetry is detected when python_isort_auto_poetry is set):
50   let g:ale_python_isort_auto_poetry = 1
51
52   call ale#test#SetFilename('../test-files/python/poetry/whatever.py')
53
54   GivenCommandOutput ['VERSION 5.7.0']
55   AssertFixer
56   \ {
57   \   'cwd': '%s:h',
58   \   'command': ale#Escape('poetry') . ' run isort' . ' --filename %s' . ' -'
59   \ }
60
61 Execute(uv is detected when python_isort_auto_uv is set):
62   let g:ale_python_isort_auto_uv = 1
63
64   call ale#test#SetFilename('../test-files/python/uv/whatever.py')
65
66   GivenCommandOutput ['VERSION 5.7.0']
67   AssertFixer
68   \ {
69   \   'cwd': '%s:h',
70   \   'command': ale#Escape('uv') . ' run isort' . ' --filename %s' . ' -'
71   \ }
72
73
74 Execute(The isort callback should not use --filename for older versions):
75   silent execute 'file ' . fnameescape(g:dir . '/../test-files/python/with_virtualenv/subdir/foo/bar.py')
76
77   " --filename option exists only after 5.7.0
78   GivenCommandOutput ['VERSION 5.6.0']
79   AssertFixer
80   \ {
81   \   'cwd': '%s:h',
82   \   'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/isort')) . ' -',
83   \ }