diff options
| author | Fabián Ezequiel Gallina | 2015-02-07 18:39:07 -0300 |
|---|---|---|
| committer | Fabián Ezequiel Gallina | 2015-02-07 18:39:07 -0300 |
| commit | 2155973e5e35d11a50ce6773bb34d5df68beea57 (patch) | |
| tree | 682fa184b144ec057533839858c6617c8d166b46 /test | |
| parent | 2d467a0ff0cd446ec0d83044a0be819cbf874cdf (diff) | |
| download | emacs-2155973e5e35d11a50ce6773bb34d5df68beea57.tar.gz emacs-2155973e5e35d11a50ce6773bb34d5df68beea57.zip | |
python.el: Keep eldoc visible while typing args.
Fixes: debbugs:19637
* lisp/progmodes/python.el (python-eldoc--get-symbol-at-point): New
function.
(python-eldoc--get-doc-at-point, python-eldoc-at-point): Use it.
* test/automated/python-tests.el
(python-eldoc--get-symbol-at-point-1)
(python-eldoc--get-symbol-at-point-2)
(python-eldoc--get-symbol-at-point-3)
(python-eldoc--get-symbol-at-point-4): New tests.
Diffstat (limited to 'test')
| -rw-r--r-- | test/ChangeLog | 8 | ||||
| -rw-r--r-- | test/automated/python-tests.el | 57 |
2 files changed, 65 insertions, 0 deletions
diff --git a/test/ChangeLog b/test/ChangeLog index b1e21511d65..ff02bd6a25d 100644 --- a/test/ChangeLog +++ b/test/ChangeLog | |||
| @@ -1,6 +1,14 @@ | |||
| 1 | 2015-02-07 Fabián Ezequiel Gallina <fgallina@gnu.org> | 1 | 2015-02-07 Fabián Ezequiel Gallina <fgallina@gnu.org> |
| 2 | 2 | ||
| 3 | * automated/python-tests.el | 3 | * automated/python-tests.el |
| 4 | (python-eldoc--get-symbol-at-point-1) | ||
| 5 | (python-eldoc--get-symbol-at-point-2) | ||
| 6 | (python-eldoc--get-symbol-at-point-3) | ||
| 7 | (python-eldoc--get-symbol-at-point-4): New tests. | ||
| 8 | |||
| 9 | 2015-02-07 Fabián Ezequiel Gallina <fgallina@gnu.org> | ||
| 10 | |||
| 11 | * automated/python-tests.el | ||
| 4 | (python-tests-visible-string): New function. | 12 | (python-tests-visible-string): New function. |
| 5 | (python-parens-electric-indent-1) | 13 | (python-parens-electric-indent-1) |
| 6 | (python-triple-quote-pairing): Fix indentation, move require calls. | 14 | (python-triple-quote-pairing): Fix indentation, move require calls. |
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 | ||