@@ -352,6 +352,91 @@ Describe filetype indent
352352 End
353353 End
354354
355+ Describe simple statement
356+ It indents the assert statement
357+ let in = "assert True \\\<CR>or False"
358+ let out = [
359+ \ 'assert True \',
360+ \ ' or False',
361+ \]
362+ Assert Equals(Insert(in), Buffer(out))
363+ End
364+
365+ It indents the del statement
366+ let in = "del spam, \\\<CR>eggs"
367+ let out = [
368+ \ 'del spam, \',
369+ \ ' eggs',
370+ \]
371+ Assert Equals(Insert(in), Buffer(out))
372+ End
373+
374+ It indents the return statement
375+ let in = "return True \\\<CR>or False"
376+ let out = [
377+ \ 'return True \',
378+ \ ' or False',
379+ \]
380+ Assert Equals(Insert(in), Buffer(out))
381+ End
382+
383+ It indents the yield statement
384+ let in = "yield spam \\\<CR>.eggs()\<CR>"
385+ let in .= "yield from ham \\\<CR>.toast()\<CR>"
386+ let in .= "yield \\\<CR>from \\\<CR>beans \\\<CR>.bacon()"
387+ let out = [
388+ \ 'yield spam \',
389+ \ ' .eggs()',
390+ \ 'yield from ham \',
391+ \ ' .toast()',
392+ \ 'yield \',
393+ \ ' from \',
394+ \ ' beans \',
395+ \ ' .bacon()',
396+ \]
397+ Assert Equals(Insert(in), Buffer(out))
398+ End
399+
400+ It indents the raise statement
401+ let in = "raise Exception() \\\<CR>.with_traceback(tb)"
402+ let out = [
403+ \ 'raise Exception() \',
404+ \ ' .with_traceback(tb)',
405+ \]
406+ Assert Equals(Insert(in), Buffer(out))
407+ End
408+
409+ It indents the import statement
410+ let in = "import spam \\\<CR>.eggs\<CR>"
411+ let in .= "from ham \\\<CR>.toast"
412+ let out = [
413+ \ 'import spam \',
414+ \ ' .eggs',
415+ \ 'from ham \',
416+ \ ' .toast',
417+ \]
418+ Assert Equals(Insert(in), Buffer(out))
419+ End
420+
421+ It indents the global statement
422+ let in = "global spam, \\\<CR>eggs"
423+ let out = [
424+ \ 'global spam, \',
425+ \ ' eggs',
426+ \]
427+ Assert Equals(Insert(in), Buffer(out))
428+ End
429+
430+ It indents the nonlocal statement
431+ let in = "nonlocal spam, \\\<CR>eggs"
432+ let out = [
433+ \ 'nonlocal spam, \',
434+ \ ' eggs',
435+ \]
436+ Assert Equals(Insert(in), Buffer(out))
437+ End
438+ End
439+
355440 Describe compound statement
356441 Describe if statement
357442 It aligns with left brackets
@@ -421,24 +506,10 @@ Describe filetype indent
421506 let in .= "elif False and \\\<CR>True:"
422507 let out = [
423508 \ 'if True and \',
424- \ ' False:',
425- \ ' pass',
426- \ 'elif False and \',
427- \ ' True:',
428- \]
429- Assert Equals(Insert(in), Buffer(out))
430- End
431-
432- It increases the indent level by 2 (line continuation)
433- let b:python_indent_multiline_statement = 1
434- let in = "if True and \\\<CR>False:\<CR>pass\<CR>"
435- let in .= "elif False and \\\<CR>True:"
436- let out = [
437- \ 'if True and \',
438- \ ' False:',
509+ \ ' False:',
439510 \ ' pass',
440511 \ 'elif False and \',
441- \ ' True:',
512+ \ ' True:',
442513 \]
443514 Assert Equals(Insert(in), Buffer(out))
444515 End
@@ -526,17 +597,7 @@ Describe filetype indent
526597 let in = "while True and \\\<CR>False:"
527598 let out = [
528599 \ 'while True and \',
529- \ ' False:',
530- \]
531- Assert Equals(Insert(in), Buffer(out))
532- End
533-
534- It increases the indent level by 2 (line continuation)
535- let b:python_indent_multiline_statement = 1
536- let in = "while True and \\\<CR>False:"
537- let out = [
538- \ 'while True and \',
539- \ ' False:',
600+ \ ' False:',
540601 \]
541602 Assert Equals(Insert(in), Buffer(out))
542603 End
@@ -610,16 +671,6 @@ Describe filetype indent
610671 Assert Equals(Insert(in), Buffer(out))
611672 End
612673
613- It increases the indent level by 2 (line continuation)
614- let b:python_indent_multiline_statement = 1
615- let in = "for _ in True, \\\<CR>False:"
616- let out = [
617- \ 'for _ in True, \',
618- \ ' False:',
619- \]
620- Assert Equals(Insert(in), Buffer(out))
621- End
622-
623674 It indents the else clause
624675 let in = "for _ in range(1):\<CR>"
625676 let in .= "for _ in range(2):\<CR>continue\<CR>"
@@ -699,20 +750,7 @@ Describe filetype indent
699750 \ 'try:',
700751 \ ' ...',
701752 \ 'except TypeError, \',
702- \ ' ValueError:',
703- \]
704- Assert Equals(Insert(in), Buffer(out))
705- End
706-
707- It increases the indent level by 2 (line continuation)
708- let b:python_indent_multiline_statement = 1
709- let in = "try:\<CR>...\<CR>"
710- let in .= "except TypeError, \\\<CR>ValueError:"
711- let out = [
712- \ 'try:',
713- \ ' ...',
714- \ 'except TypeError, \',
715- \ ' ValueError:',
753+ \ ' ValueError:',
716754 \]
717755 Assert Equals(Insert(in), Buffer(out))
718756 End
0 commit comments