diff options
| author | Noam Postavsky | 2017-05-22 12:36:20 -0400 |
|---|---|---|
| committer | Noam Postavsky | 2017-05-28 23:33:25 -0400 |
| commit | 443f37163634319a730133efe9e21933c23dc3c6 (patch) | |
| tree | 05fe9dfaf30fc3a7a49f5da3d6a5b3a23a075c42 /test/lisp/progmodes/python-tests.el | |
| parent | eafc985f7ea975f86b22d9456a2f91fe5342a9ca (diff) | |
| download | emacs-443f37163634319a730133efe9e21933c23dc3c6.tar.gz emacs-443f37163634319a730133efe9e21933c23dc3c6.zip | |
; Fix backslashes in python-tests
* test/lisp/progmodes/python-tests.el (python-indent-after-backslash-1)
(python-indent-after-backslash-2)
(python-indent-after-backslash-3)
(python-indent-after-backslash-4)
(python-indent-after-backslash-5)
(python-nav-beginning-of-statement-1)
(python-nav-end-of-statement-1)
(python-nav-forward-statement-1)
(python-nav-backward-statement-1)
(python-nav-backward-statement-2)
(python-info-statement-starts-block-p-2)
(python-info-statement-ends-block-p-2)
(python-info-beginning-of-statement-p-2)
(python-info-end-of-statement-p-2)
(python-info-beginning-of-block-p-2)
(python-info-end-of-block-p-2)
(python-info-line-ends-backslash-p-1)
(python-info-beginning-of-backslash-1)
(python-info-continuation-line-p-1)
(python-info-block-continuation-line-p-1)
(python-info-assignment-statement-p-1)
(python-info-assignment-continuation-line-p-1): Backslashes in
literals should be doubled only once to produce one backslash in the
buffer. If there backslashes inside a Python string literal in a Lisp
literal, that would need to be doubled twice, but there are no such
cases. Note that `python-tests-looking-at' takes a plain string, not
a regexp.
Diffstat (limited to 'test/lisp/progmodes/python-tests.el')
| -rw-r--r-- | test/lisp/progmodes/python-tests.el | 106 |
1 files changed, 53 insertions, 53 deletions
diff --git a/test/lisp/progmodes/python-tests.el b/test/lisp/progmodes/python-tests.el index be035351295..f76ecbbd3d4 100644 --- a/test/lisp/progmodes/python-tests.el +++ b/test/lisp/progmodes/python-tests.el | |||
| @@ -654,8 +654,8 @@ async for a in sequencer(): | |||
| 654 | "The most common case." | 654 | "The most common case." |
| 655 | (python-tests-with-temp-buffer | 655 | (python-tests-with-temp-buffer |
| 656 | " | 656 | " |
| 657 | from foo.bar.baz import something, something_1 \\\\ | 657 | from foo.bar.baz import something, something_1 \\ |
| 658 | something_2 something_3, \\\\ | 658 | something_2 something_3, \\ |
| 659 | something_4, something_5 | 659 | something_4, something_5 |
| 660 | " | 660 | " |
| 661 | (python-tests-look-at "from foo.bar.baz import something, something_1") | 661 | (python-tests-look-at "from foo.bar.baz import something, something_1") |
| @@ -675,14 +675,14 @@ from foo.bar.baz import something, something_1 \\\\ | |||
| 675 | "A pretty extreme complicated case." | 675 | "A pretty extreme complicated case." |
| 676 | (python-tests-with-temp-buffer | 676 | (python-tests-with-temp-buffer |
| 677 | " | 677 | " |
| 678 | objects = Thing.objects.all() \\\\ | 678 | objects = Thing.objects.all() \\ |
| 679 | .filter( | 679 | .filter( |
| 680 | type='toy', | 680 | type='toy', |
| 681 | status='bought' | 681 | status='bought' |
| 682 | ) \\\\ | 682 | ) \\ |
| 683 | .aggregate( | 683 | .aggregate( |
| 684 | Sum('amount') | 684 | Sum('amount') |
| 685 | ) \\\\ | 685 | ) \\ |
| 686 | .values_list() | 686 | .values_list() |
| 687 | " | 687 | " |
| 688 | (python-tests-look-at "objects = Thing.objects.all()") | 688 | (python-tests-look-at "objects = Thing.objects.all()") |
| @@ -698,7 +698,7 @@ objects = Thing.objects.all() \\\\ | |||
| 698 | (python-tests-look-at "status='bought'") | 698 | (python-tests-look-at "status='bought'") |
| 699 | (should (eq (car (python-indent-context)) :inside-paren-newline-start)) | 699 | (should (eq (car (python-indent-context)) :inside-paren-newline-start)) |
| 700 | (should (= (python-indent-calculate-indentation) 27)) | 700 | (should (= (python-indent-calculate-indentation) 27)) |
| 701 | (python-tests-look-at ") \\\\") | 701 | (python-tests-look-at ") \\") |
| 702 | (should (eq (car (python-indent-context)) :inside-paren-at-closing-paren)) | 702 | (should (eq (car (python-indent-context)) :inside-paren-at-closing-paren)) |
| 703 | (should (= (python-indent-calculate-indentation) 23)) | 703 | (should (= (python-indent-calculate-indentation) 23)) |
| 704 | (python-tests-look-at ".aggregate(") | 704 | (python-tests-look-at ".aggregate(") |
| @@ -708,7 +708,7 @@ objects = Thing.objects.all() \\\\ | |||
| 708 | (python-tests-look-at "Sum('amount')") | 708 | (python-tests-look-at "Sum('amount')") |
| 709 | (should (eq (car (python-indent-context)) :inside-paren-newline-start)) | 709 | (should (eq (car (python-indent-context)) :inside-paren-newline-start)) |
| 710 | (should (= (python-indent-calculate-indentation) 27)) | 710 | (should (= (python-indent-calculate-indentation) 27)) |
| 711 | (python-tests-look-at ") \\\\") | 711 | (python-tests-look-at ") \\") |
| 712 | (should (eq (car (python-indent-context)) :inside-paren-at-closing-paren)) | 712 | (should (eq (car (python-indent-context)) :inside-paren-at-closing-paren)) |
| 713 | (should (= (python-indent-calculate-indentation) 23)) | 713 | (should (= (python-indent-calculate-indentation) 23)) |
| 714 | (python-tests-look-at ".values_list()") | 714 | (python-tests-look-at ".values_list()") |
| @@ -723,12 +723,12 @@ objects = Thing.objects.all() \\\\ | |||
| 723 | "Backslash continuation from block start." | 723 | "Backslash continuation from block start." |
| 724 | (python-tests-with-temp-buffer | 724 | (python-tests-with-temp-buffer |
| 725 | " | 725 | " |
| 726 | with open('/path/to/some/file/you/want/to/read') as file_1, \\\\ | 726 | with open('/path/to/some/file/you/want/to/read') as file_1, \\ |
| 727 | open('/path/to/some/file/being/written', 'w') as file_2: | 727 | open('/path/to/some/file/being/written', 'w') as file_2: |
| 728 | file_2.write(file_1.read()) | 728 | file_2.write(file_1.read()) |
| 729 | " | 729 | " |
| 730 | (python-tests-look-at | 730 | (python-tests-look-at |
| 731 | "with open('/path/to/some/file/you/want/to/read') as file_1, \\\\") | 731 | "with open('/path/to/some/file/you/want/to/read') as file_1, \\") |
| 732 | (should (eq (car (python-indent-context)) :no-indent)) | 732 | (should (eq (car (python-indent-context)) :no-indent)) |
| 733 | (should (= (python-indent-calculate-indentation) 0)) | 733 | (should (= (python-indent-calculate-indentation) 0)) |
| 734 | (python-tests-look-at | 734 | (python-tests-look-at |
| @@ -744,15 +744,15 @@ with open('/path/to/some/file/you/want/to/read') as file_1, \\\\ | |||
| 744 | "Backslash continuation from assignment." | 744 | "Backslash continuation from assignment." |
| 745 | (python-tests-with-temp-buffer | 745 | (python-tests-with-temp-buffer |
| 746 | " | 746 | " |
| 747 | super_awful_assignment = some_calculation() and \\\\ | 747 | super_awful_assignment = some_calculation() and \\ |
| 748 | another_calculation() and \\\\ | 748 | another_calculation() and \\ |
| 749 | some_final_calculation() | 749 | some_final_calculation() |
| 750 | " | 750 | " |
| 751 | (python-tests-look-at | 751 | (python-tests-look-at |
| 752 | "super_awful_assignment = some_calculation() and \\\\") | 752 | "super_awful_assignment = some_calculation() and \\") |
| 753 | (should (eq (car (python-indent-context)) :no-indent)) | 753 | (should (eq (car (python-indent-context)) :no-indent)) |
| 754 | (should (= (python-indent-calculate-indentation) 0)) | 754 | (should (= (python-indent-calculate-indentation) 0)) |
| 755 | (python-tests-look-at "another_calculation() and \\\\") | 755 | (python-tests-look-at "another_calculation() and \\") |
| 756 | (should (eq (car (python-indent-context)) | 756 | (should (eq (car (python-indent-context)) |
| 757 | :after-backslash-assignment-continuation)) | 757 | :after-backslash-assignment-continuation)) |
| 758 | (should (= (python-indent-calculate-indentation) python-indent-offset)) | 758 | (should (= (python-indent-calculate-indentation) python-indent-offset)) |
| @@ -765,14 +765,14 @@ super_awful_assignment = some_calculation() and \\\\ | |||
| 765 | (python-tests-with-temp-buffer | 765 | (python-tests-with-temp-buffer |
| 766 | " | 766 | " |
| 767 | def delete_all_things(): | 767 | def delete_all_things(): |
| 768 | Thing \\\\ | 768 | Thing \\ |
| 769 | .objects.all() \\\\ | 769 | .objects.all() \\ |
| 770 | .delete() | 770 | .delete() |
| 771 | " | 771 | " |
| 772 | (python-tests-look-at "Thing \\\\") | 772 | (python-tests-look-at "Thing \\") |
| 773 | (should (eq (car (python-indent-context)) :after-block-start)) | 773 | (should (eq (car (python-indent-context)) :after-block-start)) |
| 774 | (should (= (python-indent-calculate-indentation) 4)) | 774 | (should (= (python-indent-calculate-indentation) 4)) |
| 775 | (python-tests-look-at ".objects.all() \\\\") | 775 | (python-tests-look-at ".objects.all() \\") |
| 776 | (should (eq (car (python-indent-context)) :after-backslash-first-line)) | 776 | (should (eq (car (python-indent-context)) :after-backslash-first-line)) |
| 777 | (should (= (python-indent-calculate-indentation) 8)) | 777 | (should (= (python-indent-calculate-indentation) 8)) |
| 778 | (python-tests-look-at ".delete()") | 778 | (python-tests-look-at ".delete()") |
| @@ -1874,8 +1874,8 @@ class A(object): | |||
| 1874 | (ert-deftest python-nav-beginning-of-statement-1 () | 1874 | (ert-deftest python-nav-beginning-of-statement-1 () |
| 1875 | (python-tests-with-temp-buffer | 1875 | (python-tests-with-temp-buffer |
| 1876 | " | 1876 | " |
| 1877 | v1 = 123 + \ | 1877 | v1 = 123 + \\ |
| 1878 | 456 + \ | 1878 | 456 + \\ |
| 1879 | 789 | 1879 | 789 |
| 1880 | v2 = (value1, | 1880 | v2 = (value1, |
| 1881 | value2, | 1881 | value2, |
| @@ -1922,8 +1922,8 @@ string | |||
| 1922 | (ert-deftest python-nav-end-of-statement-1 () | 1922 | (ert-deftest python-nav-end-of-statement-1 () |
| 1923 | (python-tests-with-temp-buffer | 1923 | (python-tests-with-temp-buffer |
| 1924 | " | 1924 | " |
| 1925 | v1 = 123 + \ | 1925 | v1 = 123 + \\ |
| 1926 | 456 + \ | 1926 | 456 + \\ |
| 1927 | 789 | 1927 | 789 |
| 1928 | v2 = (value1, | 1928 | v2 = (value1, |
| 1929 | value2, | 1929 | value2, |
| @@ -1976,8 +1976,8 @@ string | |||
| 1976 | (ert-deftest python-nav-forward-statement-1 () | 1976 | (ert-deftest python-nav-forward-statement-1 () |
| 1977 | (python-tests-with-temp-buffer | 1977 | (python-tests-with-temp-buffer |
| 1978 | " | 1978 | " |
| 1979 | v1 = 123 + \ | 1979 | v1 = 123 + \\ |
| 1980 | 456 + \ | 1980 | 456 + \\ |
| 1981 | 789 | 1981 | 789 |
| 1982 | v2 = (value1, | 1982 | v2 = (value1, |
| 1983 | value2, | 1983 | value2, |
| @@ -2017,8 +2017,8 @@ string | |||
| 2017 | (ert-deftest python-nav-backward-statement-1 () | 2017 | (ert-deftest python-nav-backward-statement-1 () |
| 2018 | (python-tests-with-temp-buffer | 2018 | (python-tests-with-temp-buffer |
| 2019 | " | 2019 | " |
| 2020 | v1 = 123 + \ | 2020 | v1 = 123 + \\ |
| 2021 | 456 + \ | 2021 | 456 + \\ |
| 2022 | 789 | 2022 | 789 |
| 2023 | v2 = (value1, | 2023 | v2 = (value1, |
| 2024 | value2, | 2024 | value2, |
| @@ -2059,8 +2059,8 @@ string | |||
| 2059 | :expected-result :failed | 2059 | :expected-result :failed |
| 2060 | (python-tests-with-temp-buffer | 2060 | (python-tests-with-temp-buffer |
| 2061 | " | 2061 | " |
| 2062 | v1 = 123 + \ | 2062 | v1 = 123 + \\ |
| 2063 | 456 + \ | 2063 | 456 + \\ |
| 2064 | 789 | 2064 | 789 |
| 2065 | v2 = (value1, | 2065 | v2 = (value1, |
| 2066 | value2, | 2066 | value2, |
| @@ -3954,8 +3954,8 @@ def long_function_name( | |||
| 3954 | (ert-deftest python-info-statement-starts-block-p-2 () | 3954 | (ert-deftest python-info-statement-starts-block-p-2 () |
| 3955 | (python-tests-with-temp-buffer | 3955 | (python-tests-with-temp-buffer |
| 3956 | " | 3956 | " |
| 3957 | if width == 0 and height == 0 and \\\\ | 3957 | if width == 0 and height == 0 and \\ |
| 3958 | color == 'red' and emphasis == 'strong' or \\\\ | 3958 | color == 'red' and emphasis == 'strong' or \\ |
| 3959 | highlight > 100: | 3959 | highlight > 100: |
| 3960 | raise ValueError('sorry, you lose') | 3960 | raise ValueError('sorry, you lose') |
| 3961 | " | 3961 | " |
| @@ -3979,8 +3979,8 @@ def long_function_name( | |||
| 3979 | (ert-deftest python-info-statement-ends-block-p-2 () | 3979 | (ert-deftest python-info-statement-ends-block-p-2 () |
| 3980 | (python-tests-with-temp-buffer | 3980 | (python-tests-with-temp-buffer |
| 3981 | " | 3981 | " |
| 3982 | if width == 0 and height == 0 and \\\\ | 3982 | if width == 0 and height == 0 and \\ |
| 3983 | color == 'red' and emphasis == 'strong' or \\\\ | 3983 | color == 'red' and emphasis == 'strong' or \\ |
| 3984 | highlight > 100: | 3984 | highlight > 100: |
| 3985 | raise ValueError( | 3985 | raise ValueError( |
| 3986 | 'sorry, you lose' | 3986 | 'sorry, you lose' |
| @@ -4010,8 +4010,8 @@ def long_function_name( | |||
| 4010 | (ert-deftest python-info-beginning-of-statement-p-2 () | 4010 | (ert-deftest python-info-beginning-of-statement-p-2 () |
| 4011 | (python-tests-with-temp-buffer | 4011 | (python-tests-with-temp-buffer |
| 4012 | " | 4012 | " |
| 4013 | if width == 0 and height == 0 and \\\\ | 4013 | if width == 0 and height == 0 and \\ |
| 4014 | color == 'red' and emphasis == 'strong' or \\\\ | 4014 | color == 'red' and emphasis == 'strong' or \\ |
| 4015 | highlight > 100: | 4015 | highlight > 100: |
| 4016 | raise ValueError( | 4016 | raise ValueError( |
| 4017 | 'sorry, you lose' | 4017 | 'sorry, you lose' |
| @@ -4050,8 +4050,8 @@ def long_function_name( | |||
| 4050 | (ert-deftest python-info-end-of-statement-p-2 () | 4050 | (ert-deftest python-info-end-of-statement-p-2 () |
| 4051 | (python-tests-with-temp-buffer | 4051 | (python-tests-with-temp-buffer |
| 4052 | " | 4052 | " |
| 4053 | if width == 0 and height == 0 and \\\\ | 4053 | if width == 0 and height == 0 and \\ |
| 4054 | color == 'red' and emphasis == 'strong' or \\\\ | 4054 | color == 'red' and emphasis == 'strong' or \\ |
| 4055 | highlight > 100: | 4055 | highlight > 100: |
| 4056 | raise ValueError( | 4056 | raise ValueError( |
| 4057 | 'sorry, you lose' | 4057 | 'sorry, you lose' |
| @@ -4091,8 +4091,8 @@ def long_function_name( | |||
| 4091 | (ert-deftest python-info-beginning-of-block-p-2 () | 4091 | (ert-deftest python-info-beginning-of-block-p-2 () |
| 4092 | (python-tests-with-temp-buffer | 4092 | (python-tests-with-temp-buffer |
| 4093 | " | 4093 | " |
| 4094 | if width == 0 and height == 0 and \\\\ | 4094 | if width == 0 and height == 0 and \\ |
| 4095 | color == 'red' and emphasis == 'strong' or \\\\ | 4095 | color == 'red' and emphasis == 'strong' or \\ |
| 4096 | highlight > 100: | 4096 | highlight > 100: |
| 4097 | raise ValueError( | 4097 | raise ValueError( |
| 4098 | 'sorry, you lose' | 4098 | 'sorry, you lose' |
| @@ -4129,8 +4129,8 @@ def long_function_name( | |||
| 4129 | (ert-deftest python-info-end-of-block-p-2 () | 4129 | (ert-deftest python-info-end-of-block-p-2 () |
| 4130 | (python-tests-with-temp-buffer | 4130 | (python-tests-with-temp-buffer |
| 4131 | " | 4131 | " |
| 4132 | if width == 0 and height == 0 and \\\\ | 4132 | if width == 0 and height == 0 and \\ |
| 4133 | color == 'red' and emphasis == 'strong' or \\\\ | 4133 | color == 'red' and emphasis == 'strong' or \\ |
| 4134 | highlight > 100: | 4134 | highlight > 100: |
| 4135 | raise ValueError( | 4135 | raise ValueError( |
| 4136 | 'sorry, you lose' | 4136 | 'sorry, you lose' |
| @@ -4637,14 +4637,14 @@ elif b: | |||
| 4637 | (ert-deftest python-info-line-ends-backslash-p-1 () | 4637 | (ert-deftest python-info-line-ends-backslash-p-1 () |
| 4638 | (python-tests-with-temp-buffer | 4638 | (python-tests-with-temp-buffer |
| 4639 | " | 4639 | " |
| 4640 | objects = Thing.objects.all() \\\\ | 4640 | objects = Thing.objects.all() \\ |
| 4641 | .filter( | 4641 | .filter( |
| 4642 | type='toy', | 4642 | type='toy', |
| 4643 | status='bought' | 4643 | status='bought' |
| 4644 | ) \\\\ | 4644 | ) \\ |
| 4645 | .aggregate( | 4645 | .aggregate( |
| 4646 | Sum('amount') | 4646 | Sum('amount') |
| 4647 | ) \\\\ | 4647 | ) \\ |
| 4648 | .values_list() | 4648 | .values_list() |
| 4649 | " | 4649 | " |
| 4650 | (should (python-info-line-ends-backslash-p 2)) ; .filter(... | 4650 | (should (python-info-line-ends-backslash-p 2)) ; .filter(... |
| @@ -4660,14 +4660,14 @@ objects = Thing.objects.all() \\\\ | |||
| 4660 | (ert-deftest python-info-beginning-of-backslash-1 () | 4660 | (ert-deftest python-info-beginning-of-backslash-1 () |
| 4661 | (python-tests-with-temp-buffer | 4661 | (python-tests-with-temp-buffer |
| 4662 | " | 4662 | " |
| 4663 | objects = Thing.objects.all() \\\\ | 4663 | objects = Thing.objects.all() \\ |
| 4664 | .filter( | 4664 | .filter( |
| 4665 | type='toy', | 4665 | type='toy', |
| 4666 | status='bought' | 4666 | status='bought' |
| 4667 | ) \\\\ | 4667 | ) \\ |
| 4668 | .aggregate( | 4668 | .aggregate( |
| 4669 | Sum('amount') | 4669 | Sum('amount') |
| 4670 | ) \\\\ | 4670 | ) \\ |
| 4671 | .values_list() | 4671 | .values_list() |
| 4672 | " | 4672 | " |
| 4673 | (let ((first 2) | 4673 | (let ((first 2) |
| @@ -4686,8 +4686,8 @@ objects = Thing.objects.all() \\\\ | |||
| 4686 | (ert-deftest python-info-continuation-line-p-1 () | 4686 | (ert-deftest python-info-continuation-line-p-1 () |
| 4687 | (python-tests-with-temp-buffer | 4687 | (python-tests-with-temp-buffer |
| 4688 | " | 4688 | " |
| 4689 | if width == 0 and height == 0 and \\\\ | 4689 | if width == 0 and height == 0 and \\ |
| 4690 | color == 'red' and emphasis == 'strong' or \\\\ | 4690 | color == 'red' and emphasis == 'strong' or \\ |
| 4691 | highlight > 100: | 4691 | highlight > 100: |
| 4692 | raise ValueError( | 4692 | raise ValueError( |
| 4693 | 'sorry, you lose' | 4693 | 'sorry, you lose' |
| @@ -4714,8 +4714,8 @@ if width == 0 and height == 0 and \\\\ | |||
| 4714 | (ert-deftest python-info-block-continuation-line-p-1 () | 4714 | (ert-deftest python-info-block-continuation-line-p-1 () |
| 4715 | (python-tests-with-temp-buffer | 4715 | (python-tests-with-temp-buffer |
| 4716 | " | 4716 | " |
| 4717 | if width == 0 and height == 0 and \\\\ | 4717 | if width == 0 and height == 0 and \\ |
| 4718 | color == 'red' and emphasis == 'strong' or \\\\ | 4718 | color == 'red' and emphasis == 'strong' or \\ |
| 4719 | highlight > 100: | 4719 | highlight > 100: |
| 4720 | raise ValueError( | 4720 | raise ValueError( |
| 4721 | 'sorry, you lose' | 4721 | 'sorry, you lose' |
| @@ -4749,8 +4749,8 @@ def foo(a, | |||
| 4749 | (ert-deftest python-info-assignment-statement-p-1 () | 4749 | (ert-deftest python-info-assignment-statement-p-1 () |
| 4750 | (python-tests-with-temp-buffer | 4750 | (python-tests-with-temp-buffer |
| 4751 | " | 4751 | " |
| 4752 | data = foo(), bar() \\\\ | 4752 | data = foo(), bar() \\ |
| 4753 | baz(), 4 \\\\ | 4753 | baz(), 4 \\ |
| 4754 | 5, 6 | 4754 | 5, 6 |
| 4755 | " | 4755 | " |
| 4756 | (python-tests-look-at "data = foo(), bar()") | 4756 | (python-tests-look-at "data = foo(), bar()") |
| @@ -4792,8 +4792,8 @@ data '=' 42 | |||
| 4792 | (ert-deftest python-info-assignment-continuation-line-p-1 () | 4792 | (ert-deftest python-info-assignment-continuation-line-p-1 () |
| 4793 | (python-tests-with-temp-buffer | 4793 | (python-tests-with-temp-buffer |
| 4794 | " | 4794 | " |
| 4795 | data = foo(), bar() \\\\ | 4795 | data = foo(), bar() \\ |
| 4796 | baz(), 4 \\\\ | 4796 | baz(), 4 \\ |
| 4797 | 5, 6 | 4797 | 5, 6 |
| 4798 | " | 4798 | " |
| 4799 | (python-tests-look-at "data = foo(), bar()") | 4799 | (python-tests-look-at "data = foo(), bar()") |