"The most common case."
(python-tests-with-temp-buffer
"
-from foo.bar.baz import something, something_1 \\\\
- something_2 something_3, \\\\
+from foo.bar.baz import something, something_1 \\
+ something_2 something_3, \\
something_4, something_5
"
(python-tests-look-at "from foo.bar.baz import something, something_1")
"A pretty extreme complicated case."
(python-tests-with-temp-buffer
"
-objects = Thing.objects.all() \\\\
+objects = Thing.objects.all() \\
.filter(
type='toy',
status='bought'
- ) \\\\
+ ) \\
.aggregate(
Sum('amount')
- ) \\\\
+ ) \\
.values_list()
"
(python-tests-look-at "objects = Thing.objects.all()")
(python-tests-look-at "status='bought'")
(should (eq (car (python-indent-context)) :inside-paren-newline-start))
(should (= (python-indent-calculate-indentation) 27))
- (python-tests-look-at ") \\\\")
+ (python-tests-look-at ") \\")
(should (eq (car (python-indent-context)) :inside-paren-at-closing-paren))
(should (= (python-indent-calculate-indentation) 23))
(python-tests-look-at ".aggregate(")
(python-tests-look-at "Sum('amount')")
(should (eq (car (python-indent-context)) :inside-paren-newline-start))
(should (= (python-indent-calculate-indentation) 27))
- (python-tests-look-at ") \\\\")
+ (python-tests-look-at ") \\")
(should (eq (car (python-indent-context)) :inside-paren-at-closing-paren))
(should (= (python-indent-calculate-indentation) 23))
(python-tests-look-at ".values_list()")
"Backslash continuation from block start."
(python-tests-with-temp-buffer
"
-with open('/path/to/some/file/you/want/to/read') as file_1, \\\\
+with open('/path/to/some/file/you/want/to/read') as file_1, \\
open('/path/to/some/file/being/written', 'w') as file_2:
file_2.write(file_1.read())
"
(python-tests-look-at
- "with open('/path/to/some/file/you/want/to/read') as file_1, \\\\")
+ "with open('/path/to/some/file/you/want/to/read') as file_1, \\")
(should (eq (car (python-indent-context)) :no-indent))
(should (= (python-indent-calculate-indentation) 0))
(python-tests-look-at
"Backslash continuation from assignment."
(python-tests-with-temp-buffer
"
-super_awful_assignment = some_calculation() and \\\\
- another_calculation() and \\\\
+super_awful_assignment = some_calculation() and \\
+ another_calculation() and \\
some_final_calculation()
"
(python-tests-look-at
- "super_awful_assignment = some_calculation() and \\\\")
+ "super_awful_assignment = some_calculation() and \\")
(should (eq (car (python-indent-context)) :no-indent))
(should (= (python-indent-calculate-indentation) 0))
- (python-tests-look-at "another_calculation() and \\\\")
+ (python-tests-look-at "another_calculation() and \\")
(should (eq (car (python-indent-context))
:after-backslash-assignment-continuation))
(should (= (python-indent-calculate-indentation) python-indent-offset))
(python-tests-with-temp-buffer
"
def delete_all_things():
- Thing \\\\
- .objects.all() \\\\
+ Thing \\
+ .objects.all() \\
.delete()
"
- (python-tests-look-at "Thing \\\\")
+ (python-tests-look-at "Thing \\")
(should (eq (car (python-indent-context)) :after-block-start))
(should (= (python-indent-calculate-indentation) 4))
- (python-tests-look-at ".objects.all() \\\\")
+ (python-tests-look-at ".objects.all() \\")
(should (eq (car (python-indent-context)) :after-backslash-first-line))
(should (= (python-indent-calculate-indentation) 8))
(python-tests-look-at ".delete()")
(ert-deftest python-nav-beginning-of-statement-1 ()
(python-tests-with-temp-buffer
"
-v1 = 123 + \
- 456 + \
+v1 = 123 + \\
+ 456 + \\
789
v2 = (value1,
value2,
(ert-deftest python-nav-end-of-statement-1 ()
(python-tests-with-temp-buffer
"
-v1 = 123 + \
- 456 + \
+v1 = 123 + \\
+ 456 + \\
789
v2 = (value1,
value2,
(ert-deftest python-nav-forward-statement-1 ()
(python-tests-with-temp-buffer
"
-v1 = 123 + \
- 456 + \
+v1 = 123 + \\
+ 456 + \\
789
v2 = (value1,
value2,
(ert-deftest python-nav-backward-statement-1 ()
(python-tests-with-temp-buffer
"
-v1 = 123 + \
- 456 + \
+v1 = 123 + \\
+ 456 + \\
789
v2 = (value1,
value2,
:expected-result :failed
(python-tests-with-temp-buffer
"
-v1 = 123 + \
- 456 + \
+v1 = 123 + \\
+ 456 + \\
789
v2 = (value1,
value2,
(ert-deftest python-info-statement-starts-block-p-2 ()
(python-tests-with-temp-buffer
"
-if width == 0 and height == 0 and \\\\
- color == 'red' and emphasis == 'strong' or \\\\
+if width == 0 and height == 0 and \\
+ color == 'red' and emphasis == 'strong' or \\
highlight > 100:
raise ValueError('sorry, you lose')
"
(ert-deftest python-info-statement-ends-block-p-2 ()
(python-tests-with-temp-buffer
"
-if width == 0 and height == 0 and \\\\
- color == 'red' and emphasis == 'strong' or \\\\
+if width == 0 and height == 0 and \\
+ color == 'red' and emphasis == 'strong' or \\
highlight > 100:
raise ValueError(
'sorry, you lose'
(ert-deftest python-info-beginning-of-statement-p-2 ()
(python-tests-with-temp-buffer
"
-if width == 0 and height == 0 and \\\\
- color == 'red' and emphasis == 'strong' or \\\\
+if width == 0 and height == 0 and \\
+ color == 'red' and emphasis == 'strong' or \\
highlight > 100:
raise ValueError(
'sorry, you lose'
(ert-deftest python-info-end-of-statement-p-2 ()
(python-tests-with-temp-buffer
"
-if width == 0 and height == 0 and \\\\
- color == 'red' and emphasis == 'strong' or \\\\
+if width == 0 and height == 0 and \\
+ color == 'red' and emphasis == 'strong' or \\
highlight > 100:
raise ValueError(
'sorry, you lose'
(ert-deftest python-info-beginning-of-block-p-2 ()
(python-tests-with-temp-buffer
"
-if width == 0 and height == 0 and \\\\
- color == 'red' and emphasis == 'strong' or \\\\
+if width == 0 and height == 0 and \\
+ color == 'red' and emphasis == 'strong' or \\
highlight > 100:
raise ValueError(
'sorry, you lose'
(ert-deftest python-info-end-of-block-p-2 ()
(python-tests-with-temp-buffer
"
-if width == 0 and height == 0 and \\\\
- color == 'red' and emphasis == 'strong' or \\\\
+if width == 0 and height == 0 and \\
+ color == 'red' and emphasis == 'strong' or \\
highlight > 100:
raise ValueError(
'sorry, you lose'
(ert-deftest python-info-line-ends-backslash-p-1 ()
(python-tests-with-temp-buffer
"
-objects = Thing.objects.all() \\\\
+objects = Thing.objects.all() \\
.filter(
type='toy',
status='bought'
- ) \\\\
+ ) \\
.aggregate(
Sum('amount')
- ) \\\\
+ ) \\
.values_list()
"
(should (python-info-line-ends-backslash-p 2)) ; .filter(...
(ert-deftest python-info-beginning-of-backslash-1 ()
(python-tests-with-temp-buffer
"
-objects = Thing.objects.all() \\\\
+objects = Thing.objects.all() \\
.filter(
type='toy',
status='bought'
- ) \\\\
+ ) \\
.aggregate(
Sum('amount')
- ) \\\\
+ ) \\
.values_list()
"
(let ((first 2)
(ert-deftest python-info-continuation-line-p-1 ()
(python-tests-with-temp-buffer
"
-if width == 0 and height == 0 and \\\\
- color == 'red' and emphasis == 'strong' or \\\\
+if width == 0 and height == 0 and \\
+ color == 'red' and emphasis == 'strong' or \\
highlight > 100:
raise ValueError(
'sorry, you lose'
(ert-deftest python-info-block-continuation-line-p-1 ()
(python-tests-with-temp-buffer
"
-if width == 0 and height == 0 and \\\\
- color == 'red' and emphasis == 'strong' or \\\\
+if width == 0 and height == 0 and \\
+ color == 'red' and emphasis == 'strong' or \\
highlight > 100:
raise ValueError(
'sorry, you lose'
(ert-deftest python-info-assignment-statement-p-1 ()
(python-tests-with-temp-buffer
"
-data = foo(), bar() \\\\
- baz(), 4 \\\\
+data = foo(), bar() \\
+ baz(), 4 \\
5, 6
"
(python-tests-look-at "data = foo(), bar()")
(ert-deftest python-info-assignment-continuation-line-p-1 ()
(python-tests-with-temp-buffer
"
-data = foo(), bar() \\\\
- baz(), 4 \\\\
+data = foo(), bar() \\
+ baz(), 4 \\
5, 6
"
(python-tests-look-at "data = foo(), bar()")