Show More
@@ -8,17 +8,13 b'' | |||||
8 | from inspect import signature, Signature, Parameter |
|
8 | from inspect import signature, Signature, Parameter | |
9 | import os |
|
9 | import os | |
10 | import re |
|
10 | import re | |
11 | import sys |
|
|||
12 |
|
11 | |||
13 | import nose.tools as nt |
|
12 | import nose.tools as nt | |
14 |
|
13 | |||
15 | from .. import oinspect |
|
14 | from .. import oinspect | |
16 | from IPython.core.magic import (Magics, magics_class, line_magic, |
|
15 | ||
17 | cell_magic, line_cell_magic, |
|
|||
18 | register_line_magic, register_cell_magic, |
|
|||
19 | register_line_cell_magic) |
|
|||
20 | from decorator import decorator |
|
16 | from decorator import decorator | |
21 | from IPython import get_ipython |
|
17 | ||
22 | from IPython.testing.tools import AssertPrints, AssertNotPrints |
|
18 | from IPython.testing.tools import AssertPrints, AssertNotPrints | |
23 | from IPython.utils.path import compress_user |
|
19 | from IPython.utils.path import compress_user | |
24 |
|
20 | |||
@@ -38,7 +34,7 b' ip = get_ipython()' | |||||
38 | # defined, if any code is inserted above, the following line will need to be |
|
34 | # defined, if any code is inserted above, the following line will need to be | |
39 | # updated. Do NOT insert any whitespace between the next line and the function |
|
35 | # updated. Do NOT insert any whitespace between the next line and the function | |
40 | # definition below. |
|
36 | # definition below. | |
41 |
THIS_LINE_NUMBER = |
|
37 | THIS_LINE_NUMBER = 37 # Put here the actual number of this line | |
42 |
|
38 | |||
43 | from unittest import TestCase |
|
39 | from unittest import TestCase | |
44 |
|
40 | |||
@@ -127,48 +123,6 b' class SimpleClass(object):' | |||||
127 | """Some method's docstring""" |
|
123 | """Some method's docstring""" | |
128 |
|
124 | |||
129 |
|
125 | |||
130 | class OldStyle: |
|
|||
131 | """An old-style class for testing.""" |
|
|||
132 | pass |
|
|||
133 |
|
||||
134 |
|
||||
135 | def f(x, y=2, *a, **kw): |
|
|||
136 | """A simple function.""" |
|
|||
137 |
|
||||
138 |
|
||||
139 | def g(y, z=3, *a, **kw): |
|
|||
140 | pass # no docstring |
|
|||
141 |
|
||||
142 |
|
||||
143 | @register_line_magic |
|
|||
144 | def lmagic(line): |
|
|||
145 | "A line magic" |
|
|||
146 |
|
||||
147 |
|
||||
148 | @register_cell_magic |
|
|||
149 | def cmagic(line, cell): |
|
|||
150 | "A cell magic" |
|
|||
151 |
|
||||
152 |
|
||||
153 | @register_line_cell_magic |
|
|||
154 | def lcmagic(line, cell=None): |
|
|||
155 | "A line/cell magic" |
|
|||
156 |
|
||||
157 |
|
||||
158 | @magics_class |
|
|||
159 | class SimpleMagics(Magics): |
|
|||
160 | @line_magic |
|
|||
161 | def Clmagic(self, cline): |
|
|||
162 | "A class-based line magic" |
|
|||
163 |
|
||||
164 | @cell_magic |
|
|||
165 | def Ccmagic(self, cline, ccell): |
|
|||
166 | "A class-based cell magic" |
|
|||
167 |
|
||||
168 | @line_cell_magic |
|
|||
169 | def Clcmagic(self, cline, ccell=None): |
|
|||
170 | "A class-based line/cell magic" |
|
|||
171 |
|
||||
172 |
|
126 | |||
173 | class Awkward(object): |
|
127 | class Awkward(object): | |
174 | def __getattr__(self, name): |
|
128 | def __getattr__(self, name): | |
@@ -261,9 +215,12 b' def test_info_serialliar():' | |||||
261 | # infinite loops: https://github.com/ipython/ipython/issues/9122 |
|
215 | # infinite loops: https://github.com/ipython/ipython/issues/9122 | |
262 | nt.assert_less(fib_tracker[0], 9000) |
|
216 | nt.assert_less(fib_tracker[0], 9000) | |
263 |
|
217 | |||
|
218 | def support_function_one(x, y=2, *a, **kw): | |||
|
219 | """A simple function.""" | |||
|
220 | ||||
264 | def test_calldef_none(): |
|
221 | def test_calldef_none(): | |
265 | # We should ignore __call__ for all of these. |
|
222 | # We should ignore __call__ for all of these. | |
266 | for obj in [f, SimpleClass().method, any, str.upper]: |
|
223 | for obj in [support_function_one, SimpleClass().method, any, str.upper]: | |
267 | print(obj) |
|
224 | print(obj) | |
268 | i = inspector.info(obj) |
|
225 | i = inspector.info(obj) | |
269 | nt.assert_is(i['call_def'], None) |
|
226 | nt.assert_is(i['call_def'], None) |
General Comments 0
You need to be logged in to leave comments.
Login now