summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_descrtut.py
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2016-07-14 04:13:29 (GMT)
committerBenjamin Peterson <benjamin@python.org>2016-07-14 04:13:29 (GMT)
commitab078e9ed1a5d1b693d6ee843f1a34e8993e9dee (patch)
tree55e6e21b81315f126e76357af7e545cfe498d778 /Lib/test/test_descrtut.py
parentfb4f8257bfa4471764e10c1d8525a5bb7b0145e5 (diff)
downloadcpython-ab078e9ed1a5d1b693d6ee843f1a34e8993e9dee.zip
cpython-ab078e9ed1a5d1b693d6ee843f1a34e8993e9dee.tar.gz
cpython-ab078e9ed1a5d1b693d6ee843f1a34e8993e9dee.tar.bz2
Backed out changeset af29d89083b3 (closes #25548) (closes #27498)
Diffstat (limited to 'Lib/test/test_descrtut.py')
-rw-r--r--Lib/test/test_descrtut.py31
1 files changed, 15 insertions, 16 deletions
diff --git a/Lib/test/test_descrtut.py b/Lib/test/test_descrtut.py
index 80cfa41..506d1ab 100644
--- a/Lib/test/test_descrtut.py
+++ b/Lib/test/test_descrtut.py
@@ -37,16 +37,16 @@ test_1 = """
Here's the new type at work:
>>> print(defaultdict) # show our type
- <class 'test.test_descrtut.defaultdict' ...>
+ <class 'test.test_descrtut.defaultdict'>
>>> print(type(defaultdict)) # its metatype
- <class 'type' ...>
+ <class 'type'>
>>> a = defaultdict(default=0.0) # create an instance
>>> print(a) # show the instance
{}
>>> print(type(a)) # show its type
- <class 'test.test_descrtut.defaultdict' ...>
+ <class 'test.test_descrtut.defaultdict'>
>>> print(a.__class__) # show its class
- <class 'test.test_descrtut.defaultdict' ...>
+ <class 'test.test_descrtut.defaultdict'>
>>> print(type(a) is a.__class__) # its type is its class
True
>>> a[1] = 3.25 # modify the instance
@@ -149,11 +149,11 @@ Introspecting instances of built-in types
For instance of built-in types, x.__class__ is now the same as type(x):
>>> type([])
- <class 'list' ...>
+ <class 'list'>
>>> [].__class__
- <class 'list' ...>
+ <class 'list'>
>>> list
- <class 'list' ...>
+ <class 'list'>
>>> isinstance([], list)
True
>>> isinstance([], dict)
@@ -258,19 +258,19 @@ implicit first argument that is the *class* for which they are invoked.
... print("classmethod", cls, y)
>>> C.foo(1)
- classmethod <class 'test.test_descrtut.C' ...> 1
+ classmethod <class 'test.test_descrtut.C'> 1
>>> c = C()
>>> c.foo(1)
- classmethod <class 'test.test_descrtut.C' ...> 1
+ classmethod <class 'test.test_descrtut.C'> 1
>>> class D(C):
... pass
>>> D.foo(1)
- classmethod <class 'test.test_descrtut.D' ...> 1
+ classmethod <class 'test.test_descrtut.D'> 1
>>> d = D()
>>> d.foo(1)
- classmethod <class '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
@@ -286,11 +286,11 @@ But notice this:
>>> E.foo(1)
E.foo() called
- classmethod <class 'test.test_descrtut.C' ...> 1
+ classmethod <class 'test.test_descrtut.C'> 1
>>> e = E()
>>> e.foo(1)
E.foo() called
- classmethod <class '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
@@ -350,7 +350,7 @@ Hmm -- property is builtin now, so let's try it that way too.
>>> del property # unmask the builtin
>>> property
- <class 'property' ...>
+ <class 'property'>
>>> class C(object):
... def __init__(self):
@@ -478,8 +478,7 @@ def test_main(verbose=None):
# business is used the name can change depending on how the test is
# invoked.
from test import support, test_descrtut
- import doctest
- support.run_doctest(test_descrtut, verbose, optionflags=doctest.ELLIPSIS)
+ support.run_doctest(test_descrtut, verbose)
# This part isn't needed for regrtest, but for running the test directly.
if __name__ == "__main__":