summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorThomas Wouters <thomas@python.org>2006-04-15 09:13:19 (GMT)
committerThomas Wouters <thomas@python.org>2006-04-15 09:13:19 (GMT)
commit725af87d0a0041d108b493d206fc2f8d0ca75558 (patch)
treefc72f76f79b793cf100d0a98cdc302a1f6efebb2 /Lib
parent1ae9afa829ff0b6372b9fd70365653ab6c565b3a (diff)
downloadcpython-725af87d0a0041d108b493d206fc2f8d0ca75558.zip
cpython-725af87d0a0041d108b493d206fc2f8d0ca75558.tar.gz
cpython-725af87d0a0041d108b493d206fc2f8d0ca75558.tar.bz2
- Remove tests for classic class behaviour
- Expect a new-style class tree in the getclasstree test.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_inspect.py84
1 files changed, 7 insertions, 77 deletions
diff --git a/Lib/test/test_inspect.py b/Lib/test/test_inspect.py
index ce346b9..0bdf959 100644
--- a/Lib/test/test_inspect.py
+++ b/Lib/test/test_inspect.py
@@ -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):