diff options
| author | Eli Zaretskii | 2013-04-18 19:20:48 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2013-04-18 19:20:48 +0300 |
| commit | 4f0e6095fc0bcc8b9e8bcf6bf907b957b15cf699 (patch) | |
| tree | abab34f8645852eaef34782428fbc422f8098332 /test/automated/python-tests.el | |
| parent | 224e1caae160cccd6447db6228cc617765f7ad31 (diff) | |
| parent | cdca825560c4f97fba5ccd6ba87df5c881d1ffce (diff) | |
| download | emacs-4f0e6095fc0bcc8b9e8bcf6bf907b957b15cf699.tar.gz emacs-4f0e6095fc0bcc8b9e8bcf6bf907b957b15cf699.zip | |
Merge from trunk.
Diffstat (limited to 'test/automated/python-tests.el')
| -rw-r--r-- | test/automated/python-tests.el | 108 |
1 files changed, 108 insertions, 0 deletions
diff --git a/test/automated/python-tests.el b/test/automated/python-tests.el index a7c7aab6464..15089e6b393 100644 --- a/test/automated/python-tests.el +++ b/test/automated/python-tests.el | |||
| @@ -718,6 +718,60 @@ class A(object): # A | |||
| 718 | (python-tests-look-at "class A(object): # A" -1))) | 718 | (python-tests-look-at "class A(object): # A" -1))) |
| 719 | (should (not (python-nav-backward-defun))))) | 719 | (should (not (python-nav-backward-defun))))) |
| 720 | 720 | ||
| 721 | (ert-deftest python-nav-backward-defun-2 () | ||
| 722 | (python-tests-with-temp-buffer | ||
| 723 | " | ||
| 724 | def decoratorFunctionWithArguments(arg1, arg2, arg3): | ||
| 725 | '''print decorated function call data to stdout. | ||
| 726 | |||
| 727 | Usage: | ||
| 728 | |||
| 729 | @decoratorFunctionWithArguments('arg1', 'arg2') | ||
| 730 | def func(a, b, c=True): | ||
| 731 | pass | ||
| 732 | ''' | ||
| 733 | |||
| 734 | def wwrap(f): | ||
| 735 | print 'Inside wwrap()' | ||
| 736 | def wrapped_f(*args): | ||
| 737 | print 'Inside wrapped_f()' | ||
| 738 | print 'Decorator arguments:', arg1, arg2, arg3 | ||
| 739 | f(*args) | ||
| 740 | print 'After f(*args)' | ||
| 741 | return wrapped_f | ||
| 742 | return wwrap | ||
| 743 | " | ||
| 744 | (goto-char (point-max)) | ||
| 745 | (should (= (save-excursion (python-nav-backward-defun)) | ||
| 746 | (python-tests-look-at " def wrapped_f(*args):" -1))) | ||
| 747 | (should (= (save-excursion (python-nav-backward-defun)) | ||
| 748 | (python-tests-look-at " def wwrap(f):" -1))) | ||
| 749 | (should (= (save-excursion (python-nav-backward-defun)) | ||
| 750 | (python-tests-look-at "def decoratorFunctionWithArguments(arg1, arg2, arg3):" -1))) | ||
| 751 | (should (not (python-nav-backward-defun))))) | ||
| 752 | |||
| 753 | (ert-deftest python-nav-backward-defun-3 () | ||
| 754 | (python-tests-with-temp-buffer | ||
| 755 | " | ||
| 756 | ''' | ||
| 757 | def u(self): | ||
| 758 | pass | ||
| 759 | |||
| 760 | def v(self): | ||
| 761 | pass | ||
| 762 | |||
| 763 | def w(self): | ||
| 764 | pass | ||
| 765 | ''' | ||
| 766 | |||
| 767 | class A(object): | ||
| 768 | pass | ||
| 769 | " | ||
| 770 | (goto-char (point-min)) | ||
| 771 | (let ((point (python-tests-look-at "class A(object):"))) | ||
| 772 | (should (not (python-nav-backward-defun))) | ||
| 773 | (should (= point (point)))))) | ||
| 774 | |||
| 721 | (ert-deftest python-nav-forward-defun-1 () | 775 | (ert-deftest python-nav-forward-defun-1 () |
| 722 | (python-tests-with-temp-buffer | 776 | (python-tests-with-temp-buffer |
| 723 | " | 777 | " |
| @@ -762,6 +816,60 @@ class A(object): # A | |||
| 762 | (python-tests-look-at "(self): # c"))) | 816 | (python-tests-look-at "(self): # c"))) |
| 763 | (should (not (python-nav-forward-defun))))) | 817 | (should (not (python-nav-forward-defun))))) |
| 764 | 818 | ||
| 819 | (ert-deftest python-nav-forward-defun-2 () | ||
| 820 | (python-tests-with-temp-buffer | ||
| 821 | " | ||
| 822 | def decoratorFunctionWithArguments(arg1, arg2, arg3): | ||
| 823 | '''print decorated function call data to stdout. | ||
| 824 | |||
| 825 | Usage: | ||
| 826 | |||
| 827 | @decoratorFunctionWithArguments('arg1', 'arg2') | ||
| 828 | def func(a, b, c=True): | ||
| 829 | pass | ||
| 830 | ''' | ||
| 831 | |||
| 832 | def wwrap(f): | ||
| 833 | print 'Inside wwrap()' | ||
| 834 | def wrapped_f(*args): | ||
| 835 | print 'Inside wrapped_f()' | ||
| 836 | print 'Decorator arguments:', arg1, arg2, arg3 | ||
| 837 | f(*args) | ||
| 838 | print 'After f(*args)' | ||
| 839 | return wrapped_f | ||
| 840 | return wwrap | ||
| 841 | " | ||
| 842 | (goto-char (point-min)) | ||
| 843 | (should (= (save-excursion (python-nav-forward-defun)) | ||
| 844 | (python-tests-look-at "(arg1, arg2, arg3):"))) | ||
| 845 | (should (= (save-excursion (python-nav-forward-defun)) | ||
| 846 | (python-tests-look-at "(f):"))) | ||
| 847 | (should (= (save-excursion (python-nav-forward-defun)) | ||
| 848 | (python-tests-look-at "(*args):"))) | ||
| 849 | (should (not (python-nav-forward-defun))))) | ||
| 850 | |||
| 851 | (ert-deftest python-nav-forward-defun-3 () | ||
| 852 | (python-tests-with-temp-buffer | ||
| 853 | " | ||
| 854 | class A(object): | ||
| 855 | pass | ||
| 856 | |||
| 857 | ''' | ||
| 858 | def u(self): | ||
| 859 | pass | ||
| 860 | |||
| 861 | def v(self): | ||
| 862 | pass | ||
| 863 | |||
| 864 | def w(self): | ||
| 865 | pass | ||
| 866 | ''' | ||
| 867 | " | ||
| 868 | (goto-char (point-min)) | ||
| 869 | (let ((point (python-tests-look-at "(object):"))) | ||
| 870 | (should (not (python-nav-forward-defun))) | ||
| 871 | (should (= point (point)))))) | ||
| 872 | |||
| 765 | (ert-deftest python-nav-beginning-of-statement-1 () | 873 | (ert-deftest python-nav-beginning-of-statement-1 () |
| 766 | (python-tests-with-temp-buffer | 874 | (python-tests-with-temp-buffer |
| 767 | " | 875 | " |