Show More
@@ -20,6 +20,7 b' import nose.tools as nt' | |||
|
20 | 20 | |
|
21 | 21 | # Our own imports |
|
22 | 22 | from .. import oinspect |
|
23 | from IPython.utils import py3compat | |
|
23 | 24 | |
|
24 | 25 | #----------------------------------------------------------------------------- |
|
25 | 26 | # Globals and constants |
@@ -96,7 +97,8 b' def test_info():' | |||
|
96 | 97 | "Check that Inspector.info fills out various fields as expected." |
|
97 | 98 | i = inspector.info(Call, oname='Call') |
|
98 | 99 | nt.assert_equal(i['type_name'], 'type') |
|
99 | nt.assert_equal(i['base_class'], "<type 'type'>") | |
|
100 | expted_class = str(type(type)) # <class 'type'> (Python 3) or <type 'type'> | |
|
101 | nt.assert_equal(i['base_class'], expted_class) | |
|
100 | 102 | nt.assert_equal(i['string_form'], "<class 'IPython.core.tests.test_oinspect.Call'>") |
|
101 | 103 | fname = __file__ |
|
102 | 104 | if fname.endswith(".pyc"): |
@@ -125,9 +127,10 b' def test_info():' | |||
|
125 | 127 | nt.assert_equal(i['call_docstring'], c.__call__.__doc__) |
|
126 | 128 | |
|
127 | 129 | # Test old-style classes, which for example may not have an __init__ method. |
|
128 | i = inspector.info(OldStyle) | |
|
129 | nt.assert_equal(i['type_name'], 'classobj') | |
|
130 | ||
|
131 | i = inspector.info(OldStyle()) | |
|
132 | nt.assert_equal(i['type_name'], 'instance') | |
|
133 |
nt.assert_equal(i[' |
|
|
130 | if not py3compat.PY3: | |
|
131 | i = inspector.info(OldStyle) | |
|
132 | nt.assert_equal(i['type_name'], 'classobj') | |
|
133 | ||
|
134 | i = inspector.info(OldStyle()) | |
|
135 | nt.assert_equal(i['type_name'], 'instance') | |
|
136 | nt.assert_equal(i['docstring'], OldStyle.__doc__) |
General Comments 0
You need to be logged in to leave comments.
Login now