Commits

Anonymous committed 10a3bfb

Added keywords continue and return - now these two keywords unindent code

Comments (0)

Files changed (2)

 
 
 def should_unindent_after(parsed_line):
-    unindentation_words = ('pass', 'break')
+    unindentation_words = ('pass', 'break', 'continue', 'return')
     return parsed_line.split()[0].replace(':', '').strip() in unindentation_words
 
 
         self.do_it()
 
 
+    def test_unindent_with_continue_keyword_in_second_level_indentation(self):
+        self.input_ = '''{{for a in b:
+if a == 10:
+continue
+pass}} test'''
+        self.expected_output = '''for a in b:
+    if a == 10:
+        continue
+response.write(" test", escape=False)'''
+        self.do_it()
+
+
+    def test_return_with_continue_keyword_in_second_level_indentation(self):
+        self.input_ = '''{{def some_function(arg):
+if arg == 10:
+return True
+pass}} test'''
+        self.expected_output = '''def some_function(arg):
+    if arg == 10:
+        return True
+response.write(" test", escape=False)'''
+        self.do_it()
+
 #Some thoughts...
-#About Python code:
-# test unindent: continue return
-
 #About HTML:
 # what if we have quotes on HTML?
 # response.write should change \n by \\n on HTML strings