Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
725af87d
Commit
725af87d
authored
Apr 15, 2006
by
Thomas Wouters
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Remove tests for classic class behaviour
- Expect a new-style class tree in the getclasstree test.
parent
1ae9afa8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
77 deletions
+7
-77
Lib/test/test_inspect.py
Lib/test/test_inspect.py
+7
-77
No files found.
Lib/test/test_inspect.py
View file @
725af87d
...
...
@@ -139,11 +139,13 @@ class TestRetrievingSourceCode(GetSourceBase):
(
'StupidGit'
,
mod
.
StupidGit
)])
tree
=
inspect
.
getclasstree
([
cls
[
1
]
for
cls
in
classes
],
1
)
self
.
assertEqual
(
tree
,
[(
mod
.
ParrotDroppings
,
()),
(
mod
.
StupidGit
,
()),
[(
mod
.
MalodorousPervert
,
(
mod
.
StupidGit
,)),
[(
mod
.
FesteringGob
,
(
mod
.
MalodorousPervert
,
mod
.
ParrotDroppings
))
[(
object
,
()),
[(
mod
.
ParrotDroppings
,
(
object
,)),
(
mod
.
StupidGit
,
(
object
,)),
[(
mod
.
MalodorousPervert
,
(
mod
.
StupidGit
,)),
[(
mod
.
FesteringGob
,
(
mod
.
MalodorousPervert
,
mod
.
ParrotDroppings
))
]
]
]
])
...
...
@@ -255,17 +257,6 @@ def attrs_wo_objs(cls):
return
[
t
[:
3
]
for
t
in
inspect
.
classify_class_attrs
(
cls
)]
class
TestClassesAndFunctions
(
unittest
.
TestCase
):
def
test_classic_mro
(
self
):
# Test classic-class method resolution order.
class
A
:
pass
class
B
(
A
):
pass
class
C
(
A
):
pass
class
D
(
B
,
C
):
pass
expected
=
(
D
,
B
,
A
,
C
)
got
=
inspect
.
getmro
(
D
)
self
.
assertEqual
(
expected
,
got
)
def
test_newstyle_mro
(
self
):
# The same w/ new-class MRO.
class
A
(
object
):
pass
...
...
@@ -308,67 +299,6 @@ class TestClassesAndFunctions(unittest.TestCase):
self
.
assertArgSpecEquals
(
sublistOfOne
,
[[
'foo'
]])
def
test_classify_oldstyle
(
self
):
class
A
:
def
s
():
pass
s
=
staticmethod
(
s
)
def
c
(
cls
):
pass
c
=
classmethod
(
c
)
def
getp
(
self
):
pass
p
=
property
(
getp
)
def
m
(
self
):
pass
def
m1
(
self
):
pass
datablob
=
'1'
attrs
=
attrs_wo_objs
(
A
)
self
.
assert_
((
's'
,
'static method'
,
A
)
in
attrs
,
'missing static method'
)
self
.
assert_
((
'c'
,
'class method'
,
A
)
in
attrs
,
'missing class method'
)
self
.
assert_
((
'p'
,
'property'
,
A
)
in
attrs
,
'missing property'
)
self
.
assert_
((
'm'
,
'method'
,
A
)
in
attrs
,
'missing plain method'
)
self
.
assert_
((
'm1'
,
'method'
,
A
)
in
attrs
,
'missing plain method'
)
self
.
assert_
((
'datablob'
,
'data'
,
A
)
in
attrs
,
'missing data'
)
class
B
(
A
):
def
m
(
self
):
pass
attrs
=
attrs_wo_objs
(
B
)
self
.
assert_
((
's'
,
'static method'
,
A
)
in
attrs
,
'missing static method'
)
self
.
assert_
((
'c'
,
'class method'
,
A
)
in
attrs
,
'missing class method'
)
self
.
assert_
((
'p'
,
'property'
,
A
)
in
attrs
,
'missing property'
)
self
.
assert_
((
'm'
,
'method'
,
B
)
in
attrs
,
'missing plain method'
)
self
.
assert_
((
'm1'
,
'method'
,
A
)
in
attrs
,
'missing plain method'
)
self
.
assert_
((
'datablob'
,
'data'
,
A
)
in
attrs
,
'missing data'
)
class
C
(
A
):
def
m
(
self
):
pass
def
c
(
self
):
pass
attrs
=
attrs_wo_objs
(
C
)
self
.
assert_
((
's'
,
'static method'
,
A
)
in
attrs
,
'missing static method'
)
self
.
assert_
((
'c'
,
'method'
,
C
)
in
attrs
,
'missing plain method'
)
self
.
assert_
((
'p'
,
'property'
,
A
)
in
attrs
,
'missing property'
)
self
.
assert_
((
'm'
,
'method'
,
C
)
in
attrs
,
'missing plain method'
)
self
.
assert_
((
'm1'
,
'method'
,
A
)
in
attrs
,
'missing plain method'
)
self
.
assert_
((
'datablob'
,
'data'
,
A
)
in
attrs
,
'missing data'
)
class
D
(
B
,
C
):
def
m1
(
self
):
pass
attrs
=
attrs_wo_objs
(
D
)
self
.
assert_
((
's'
,
'static method'
,
A
)
in
attrs
,
'missing static method'
)
self
.
assert_
((
'c'
,
'class method'
,
A
)
in
attrs
,
'missing class method'
)
self
.
assert_
((
'p'
,
'property'
,
A
)
in
attrs
,
'missing property'
)
self
.
assert_
((
'm'
,
'method'
,
B
)
in
attrs
,
'missing plain method'
)
self
.
assert_
((
'm1'
,
'method'
,
D
)
in
attrs
,
'missing plain method'
)
self
.
assert_
((
'datablob'
,
'data'
,
A
)
in
attrs
,
'missing data'
)
# Repeat all that, but w/ new-style classes.
def
test_classify_newstyle
(
self
):
class
A
(
object
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment