diff options
Diffstat (limited to 'test/automated/python-tests.el')
| -rw-r--r-- | test/automated/python-tests.el | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/test/automated/python-tests.el b/test/automated/python-tests.el index e5fcda95012..47e2a6e8195 100644 --- a/test/automated/python-tests.el +++ b/test/automated/python-tests.el | |||
| @@ -2943,6 +2943,63 @@ class Foo(models.Model): | |||
| 2943 | 2943 | ||
| 2944 | ;;; Eldoc | 2944 | ;;; Eldoc |
| 2945 | 2945 | ||
| 2946 | (ert-deftest python-eldoc--get-symbol-at-point-1 () | ||
| 2947 | "Test paren handling." | ||
| 2948 | (python-tests-with-temp-buffer | ||
| 2949 | " | ||
| 2950 | map(xx | ||
| 2951 | map(codecs.open('somefile' | ||
| 2952 | " | ||
| 2953 | (python-tests-look-at "ap(xx") | ||
| 2954 | (should (string= (python-eldoc--get-symbol-at-point) "map")) | ||
| 2955 | (goto-char (line-end-position)) | ||
| 2956 | (should (string= (python-eldoc--get-symbol-at-point) "map")) | ||
| 2957 | (python-tests-look-at "('somefile'") | ||
| 2958 | (should (string= (python-eldoc--get-symbol-at-point) "map")) | ||
| 2959 | (goto-char (line-end-position)) | ||
| 2960 | (should (string= (python-eldoc--get-symbol-at-point) "codecs.open")))) | ||
| 2961 | |||
| 2962 | (ert-deftest python-eldoc--get-symbol-at-point-2 () | ||
| 2963 | "Ensure self is replaced with the class name." | ||
| 2964 | (python-tests-with-temp-buffer | ||
| 2965 | " | ||
| 2966 | class TheClass: | ||
| 2967 | |||
| 2968 | def some_method(self, n): | ||
| 2969 | return n | ||
| 2970 | |||
| 2971 | def other(self): | ||
| 2972 | return self.some_method(1234) | ||
| 2973 | |||
| 2974 | " | ||
| 2975 | (python-tests-look-at "self.some_method") | ||
| 2976 | (should (string= (python-eldoc--get-symbol-at-point) | ||
| 2977 | "TheClass.some_method")) | ||
| 2978 | (python-tests-look-at "1234)") | ||
| 2979 | (should (string= (python-eldoc--get-symbol-at-point) | ||
| 2980 | "TheClass.some_method")))) | ||
| 2981 | |||
| 2982 | (ert-deftest python-eldoc--get-symbol-at-point-3 () | ||
| 2983 | "Ensure symbol is found when point is at end of buffer." | ||
| 2984 | (python-tests-with-temp-buffer | ||
| 2985 | " | ||
| 2986 | some_symbol | ||
| 2987 | |||
| 2988 | " | ||
| 2989 | (goto-char (point-max)) | ||
| 2990 | (should (string= (python-eldoc--get-symbol-at-point) | ||
| 2991 | "some_symbol")))) | ||
| 2992 | |||
| 2993 | (ert-deftest python-eldoc--get-symbol-at-point-4 () | ||
| 2994 | "Ensure symbol is found when point is at whitespace." | ||
| 2995 | (python-tests-with-temp-buffer | ||
| 2996 | " | ||
| 2997 | some_symbol some_other_symbol | ||
| 2998 | " | ||
| 2999 | (python-tests-look-at " some_other_symbol") | ||
| 3000 | (should (string= (python-eldoc--get-symbol-at-point) | ||
| 3001 | "some_symbol")))) | ||
| 3002 | |||
| 2946 | 3003 | ||
| 2947 | ;;; Imenu | 3004 | ;;; Imenu |
| 2948 | 3005 | ||