File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -88,7 +88,7 @@ function! sj#python#SplitTuple()
8888endfunction
8989
9090function ! sj#python#JoinTuple ()
91- return s: JoinList (' ([^)]*\s*$' , ' (' , ' )' )
91+ return s: JoinList (' ([^( )]*\s*$' , ' (' , ' )' )
9292endfunction
9393
9494function ! sj#python#SplitImport ()
Original file line number Diff line number Diff line change 66 before :each do
77 vim . set ( :expandtab )
88 vim . set ( :shiftwidth , 4 )
9+
10+ vim . command 'unlet! b:splitjoin_python_import_style'
11+ vim . command 'unlet! b:splitjoin_python_brackets_on_separate_lines'
912 end
1013
1114 specify "dictionaries" do
@@ -282,6 +285,30 @@ def example():
282285 EOF
283286 end
284287
288+ specify "tuple within tuple" do
289+ set_file_contents <<~EOF
290+ out = Foo(Bar(baz, bla))
291+ EOF
292+
293+ vim . command 'let b:splitjoin_python_brackets_on_separate_lines = 1'
294+ vim . search ( 'baz' )
295+ split
296+
297+ assert_file_contents <<~EOF
298+ out = Foo(Bar(
299+ baz,
300+ bla
301+ ))
302+ EOF
303+
304+ vim . search ( 'Bar\zs(' )
305+ join
306+
307+ assert_file_contents <<~EOF
308+ out = Foo(Bar(baz, bla))
309+ EOF
310+ end
311+
285312 specify "list comprehensions" do
286313 pending "Old version on CI" if ENV [ 'CI' ]
287314
You can’t perform that action at this time.
0 commit comments