summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorThomas Wouters <thomas@python.org>2006-04-15 09:03:16 (GMT)
committerThomas Wouters <thomas@python.org>2006-04-15 09:03:16 (GMT)
commit28bc76897757ed614dfdccbea7902043221fe141 (patch)
treea83f801a0ed826f02dd169390d939199d3cf7951 /Lib/test
parent6caa07b23d4f838d00a9d27efc76e412549b1de9 (diff)
downloadcpython-28bc76897757ed614dfdccbea7902043221fe141.zip
cpython-28bc76897757ed614dfdccbea7902043221fe141.tar.gz
cpython-28bc76897757ed614dfdccbea7902043221fe141.tar.bz2
- Fix doctest results to account for classes being new-style, and thus
printing differently. - Fix doctest for classic-class behaviour, make it test new-style behaviour on an implicitly-new-style class instead.
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_descrtut.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/Lib/test/test_descrtut.py b/Lib/test/test_descrtut.py
index 9dcfca1..6a5310c 100644
--- a/Lib/test/test_descrtut.py
+++ b/Lib/test/test_descrtut.py
@@ -265,19 +265,19 @@ implicit first argument that is the *class* for which they are invoked.
... print "classmethod", cls, y
>>> C.foo(1)
- classmethod test.test_descrtut.C 1
+ classmethod <class 'test.test_descrtut.C'> 1
>>> c = C()
>>> c.foo(1)
- classmethod test.test_descrtut.C 1
+ classmethod <class 'test.test_descrtut.C'> 1
>>> class D(C):
... pass
>>> D.foo(1)
- classmethod test.test_descrtut.D 1
+ classmethod <class 'test.test_descrtut.D'> 1
>>> d = D()
>>> d.foo(1)
- classmethod test.test_descrtut.D 1
+ classmethod <class 'test.test_descrtut.D'> 1
This prints "classmethod __main__.D 1" both times; in other words, the
class passed as the first argument of foo() is the class involved in the
@@ -293,11 +293,11 @@ But notice this:
>>> E.foo(1)
E.foo() called
- classmethod test.test_descrtut.C 1
+ classmethod <class 'test.test_descrtut.C'> 1
>>> e = E()
>>> e.foo(1)
E.foo() called
- classmethod test.test_descrtut.C 1
+ classmethod <class 'test.test_descrtut.C'> 1
In this example, the call to C.foo() from E.foo() will see class C as its
first argument, not class E. This is to be expected, since the call
@@ -386,7 +386,7 @@ Method resolution order
This example is implicit in the writeup.
->>> class A: # classic class
+>>> class A: # implicit new-style class
... def save(self):
... print "called A.save()"
>>> class B(A):
@@ -398,9 +398,9 @@ This example is implicit in the writeup.
... pass
>>> D().save()
-called A.save()
+called C.save()
->>> class A(object): # new class
+>>> class A(object): # explicit new-style class
... def save(self):
... print "called A.save()"
>>> class B(A):