File tree Expand file tree Collapse file tree 3 files changed +23
-5
lines changed
Expand file tree Collapse file tree 3 files changed +23
-5
lines changed Original file line number Diff line number Diff line change 2626 run : |
2727 python -m pip install --upgrade pip
2828 pip install -r requirements.txt
29- pip install pytest pytest-cov urwid twisted watchdog "jedi >=0.16" babel "sphinx >=1.5"
29+ pip install urwid twisted watchdog "jedi >=0.16" babel "sphinx >=1.5"
30+ pip install pytest pytest-cov numpy
3031 - name : Build with Python ${{ matrix.python-version }}
3132 run : |
3233 python setup.py build
Original file line number Diff line number Diff line change 2424import inspect
2525import keyword
2626import pydoc
27+ import re
2728from collections import namedtuple
2829
2930from pygments .token import Token
@@ -173,7 +174,9 @@ def fixlongargs(f, argspec):
173174 argspec [3 ] = values
174175
175176
176- getpydocspec_re = LazyReCompile (r"([a-zA-Z_][a-zA-Z0-9_]*?)\((.*?)\)" )
177+ getpydocspec_re = LazyReCompile (
178+ r"([a-zA-Z_][a-zA-Z0-9_]*?)\((.*?)\)" , re .DOTALL
179+ )
177180
178181
179182def getpydocspec (f , func ):
@@ -189,10 +192,10 @@ def getpydocspec(f, func):
189192 if not hasattr_safe (f , "__name__" ) or s .groups ()[0 ] != f .__name__ :
190193 return None
191194
192- args = list ()
193- defaults = list ()
195+ args = []
196+ defaults = []
194197 varargs = varkwargs = None
195- kwonly_args = list ()
198+ kwonly_args = []
196199 kwonly_defaults = dict ()
197200 for arg in s .group (2 ).split ("," ):
198201 arg = arg .strip ()
Original file line number Diff line number Diff line change 66from bpython .test .fodder import encoding_latin1
77from bpython .test .fodder import encoding_utf8
88
9+ try :
10+ import numpy
11+ except ImportError :
12+ numpy = None
13+
914
1015foo_ascii_only = '''def foo():
1116 """Test"""
@@ -113,6 +118,15 @@ def test_get_source_file(self):
113118 )
114119 self .assertEqual (encoding , "utf-8" )
115120
121+ @unittest .skipUnless (numpy is not None , "requires numpy" )
122+ def test_getfuncprops_numpy_array (self ):
123+ props = inspection .getfuncprops ("array" , numpy .array )
124+
125+ self .assertEqual (props .func , "array" )
126+ # This check might need an update in the future, but at least numpy >= 1.18 has
127+ # np.array(object, dtype=None, *, ...).
128+ self .assertEqual (props .argspec .args , ["object" , "dtype" ])
129+
116130
117131class A :
118132 a = "a"
You can’t perform that action at this time.
0 commit comments