summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2008-04-07 05:43:42 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2008-04-07 05:43:42 (GMT)
commit250ad613f3ae7e237e28d3a7a15a9b6fac16129f (patch)
tree5484e62a1ee0b0d9b7008cad32ab33392db7e78e /Lib/test
parent5a6f4585fdc52959bcc0dfdb9d25f2d34f983300 (diff)
downloadcpython-250ad613f3ae7e237e28d3a7a15a9b6fac16129f.zip
cpython-250ad613f3ae7e237e28d3a7a15a9b6fac16129f.tar.gz
cpython-250ad613f3ae7e237e28d3a7a15a9b6fac16129f.tar.bz2
Bug #2565: The repr() of type objects now calls them 'class',
not 'type' - whether they are builtin types or not.
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_defaultdict.py2
-rw-r--r--Lib/test/test_descrtut.py10
-rw-r--r--Lib/test/test_doctest3.txt2
-rw-r--r--Lib/test/test_generators.py34
-rw-r--r--Lib/test/test_genexps.py2
-rw-r--r--Lib/test/test_metaclass.py6
-rwxr-xr-xLib/test/test_wsgiref.py2
-rw-r--r--Lib/test/test_xmlrpc.py4
8 files changed, 31 insertions, 31 deletions
diff --git a/Lib/test/test_defaultdict.py b/Lib/test/test_defaultdict.py
index 6eb25ad..065cc10 100644
--- a/Lib/test/test_defaultdict.py
+++ b/Lib/test/test_defaultdict.py
@@ -64,7 +64,7 @@ class TestDefaultDict(unittest.TestCase):
d2 = defaultdict(int)
self.assertEqual(d2.default_factory, int)
d2[12] = 42
- self.assertEqual(repr(d2), "defaultdict(<type 'int'>, {12: 42})")
+ self.assertEqual(repr(d2), "defaultdict(<class 'int'>, {12: 42})")
def foo(): return 43
d3 = defaultdict(foo)
self.assert_(d3.default_factory is foo)
diff --git a/Lib/test/test_descrtut.py b/Lib/test/test_descrtut.py
index 4933c9f..1ddab0e 100644
--- a/Lib/test/test_descrtut.py
+++ b/Lib/test/test_descrtut.py
@@ -39,7 +39,7 @@ Here's the new type at work:
>>> print(defaultdict) # show our type
<class 'test.test_descrtut.defaultdict'>
>>> print(type(defaultdict)) # its metatype
- <type 'type'>
+ <class 'type'>
>>> a = defaultdict(default=0.0) # create an instance
>>> print(a) # show 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([])
- <type 'list'>
+ <class 'list'>
>>> [].__class__
- <type 'list'>
+ <class 'list'>
>>> list
- <type 'list'>
+ <class 'list'>
>>> isinstance([], list)
True
>>> isinstance([], dict)
@@ -346,7 +346,7 @@ Hmm -- property is builtin now, so let's try it that way too.
>>> del property # unmask the builtin
>>> property
- <type 'property'>
+ <class 'property'>
>>> class C(object):
... def __init__(self):
diff --git a/Lib/test/test_doctest3.txt b/Lib/test/test_doctest3.txt
index 54a96d5..dd8557e 100644
--- a/Lib/test/test_doctest3.txt
+++ b/Lib/test/test_doctest3.txt
@@ -2,4 +2,4 @@
Here we check that `__file__` is provided:
>>> type(__file__)
- <type 'str'>
+ <class 'str'>
diff --git a/Lib/test/test_generators.py b/Lib/test/test_generators.py
index 04f1359..992126f 100644
--- a/Lib/test/test_generators.py
+++ b/Lib/test/test_generators.py
@@ -377,10 +377,10 @@ From the Iterators list, about the types of these things.
... yield 1
...
>>> type(g)
-<type 'function'>
+<class 'function'>
>>> i = g()
>>> type(i)
-<type 'generator'>
+<class 'generator'>
>>> [s for s in dir(i) if not s.startswith('_')]
['close', 'gi_code', 'gi_frame', 'gi_running', 'send', 'throw']
>>> print(i.__next__.__doc__)
@@ -396,7 +396,7 @@ And more, added later.
>>> i.gi_running
0
>>> type(i.gi_frame)
-<type 'frame'>
+<class 'frame'>
>>> i.gi_running = 42
Traceback (most recent call last):
...
@@ -794,27 +794,27 @@ These are fine:
>>> def f():
... yield
>>> type(f())
-<type 'generator'>
+<class 'generator'>
>>> def f():
... if 0:
... yield
>>> type(f())
-<type 'generator'>
+<class 'generator'>
>>> def f():
... if 0:
... yield 1
>>> type(f())
-<type 'generator'>
+<class 'generator'>
>>> def f():
... if "":
... yield None
>>> type(f())
-<type 'generator'>
+<class 'generator'>
>>> def f():
... return
@@ -838,7 +838,7 @@ These are fine:
... x = 1
... return
>>> type(f())
-<type 'generator'>
+<class 'generator'>
>>> def f():
... if 0:
@@ -846,7 +846,7 @@ These are fine:
... yield 1
...
>>> type(f())
-<type 'NoneType'>
+<class 'NoneType'>
>>> def f():
... if 0:
@@ -856,7 +856,7 @@ These are fine:
... def f(self):
... yield 2
>>> type(f())
-<type 'NoneType'>
+<class 'NoneType'>
>>> def f():
... if 0:
@@ -864,7 +864,7 @@ These are fine:
... if 0:
... yield 2
>>> type(f())
-<type 'generator'>
+<class 'generator'>
>>> def f():
@@ -1512,7 +1512,7 @@ And a more sane, but still weird usage:
>>> def f(): list(i for i in [(yield 26)])
>>> type(f())
-<type 'generator'>
+<class 'generator'>
A yield expression with augmented assignment.
@@ -1749,25 +1749,25 @@ enclosing function a generator:
>>> def f(): x += yield
>>> type(f())
-<type 'generator'>
+<class 'generator'>
>>> def f(): x = yield
>>> type(f())
-<type 'generator'>
+<class 'generator'>
>>> def f(): lambda x=(yield): 1
>>> type(f())
-<type 'generator'>
+<class 'generator'>
>>> def f(): x=(i for i in (yield) if (yield))
>>> type(f())
-<type 'generator'>
+<class 'generator'>
>>> def f(d): d[(yield "a")] = d[(yield "b")] = 27
>>> data = [1,2]
>>> g = f(data)
>>> type(g)
-<type 'generator'>
+<class 'generator'>
>>> g.send(None)
'a'
>>> data
diff --git a/Lib/test/test_genexps.py b/Lib/test/test_genexps.py
index 6c60d02..46f7ab8 100644
--- a/Lib/test/test_genexps.py
+++ b/Lib/test/test_genexps.py
@@ -27,7 +27,7 @@ Test first class
>>> g = (i*i for i in range(4))
>>> type(g)
- <type 'generator'>
+ <class 'generator'>
>>> list(g)
[0, 1, 4, 9]
diff --git a/Lib/test/test_metaclass.py b/Lib/test/test_metaclass.py
index abb3330..733418e 100644
--- a/Lib/test/test_metaclass.py
+++ b/Lib/test/test_metaclass.py
@@ -78,7 +78,7 @@ Also pass another keyword.
>>> class C(object, metaclass=M, other="haha"):
... pass
...
- Prepare called: ('C', (<type 'object'>,)) {'other': 'haha'}
+ Prepare called: ('C', (<class 'object'>,)) {'other': 'haha'}
New called: {'other': 'haha'}
>>> C.__class__ is M
True
@@ -104,7 +104,7 @@ Use various combinations of explicit keywords and **kwds.
>>> kwds = {'metaclass': M, 'other': 'haha'}
>>> class C(*bases, **kwds): pass
...
- Prepare called: ('C', (<type 'object'>,)) {'other': 'haha'}
+ Prepare called: ('C', (<class 'object'>,)) {'other': 'haha'}
New called: {'other': 'haha'}
>>> C.__class__ is M
True
@@ -114,7 +114,7 @@ Use various combinations of explicit keywords and **kwds.
>>> kwds = {'other': 'haha'}
>>> class C(B, metaclass=M, *bases, **kwds): pass
...
- Prepare called: ('C', (<class 'test.test_metaclass.B'>, <type 'object'>)) {'other': 'haha'}
+ Prepare called: ('C', (<class 'test.test_metaclass.B'>, <class 'object'>)) {'other': 'haha'}
New called: {'other': 'haha'}
>>> C.__class__ is M
True
diff --git a/Lib/test/test_wsgiref.py b/Lib/test/test_wsgiref.py
index bcf6352..c02f0af 100755
--- a/Lib/test/test_wsgiref.py
+++ b/Lib/test/test_wsgiref.py
@@ -157,7 +157,7 @@ class IntegrationTests(TestCase):
self.assertEqual(
err.splitlines()[-2],
"AssertionError: Headers (('Content-Type', 'text/plain')) must"
- " be of type list: <type 'tuple'>"
+ " be of type list: <class 'tuple'>"
)
diff --git a/Lib/test/test_xmlrpc.py b/Lib/test/test_xmlrpc.py
index 0691f23..e708927 100644
--- a/Lib/test/test_xmlrpc.py
+++ b/Lib/test/test_xmlrpc.py
@@ -416,12 +416,12 @@ class SimpleServerTestCase(unittest.TestCase):
result = multicall()
# result.results contains;
- # [{'faultCode': 1, 'faultString': '<type \'exceptions.Exception\'>:'
+ # [{'faultCode': 1, 'faultString': '<class \'exceptions.Exception\'>:'
# 'method "this_is_not_exists" is not supported'>}]
self.assertEqual(result.results[0]['faultCode'], 1)
self.assertEqual(result.results[0]['faultString'],
- '<type \'Exception\'>:method "this_is_not_exists" '
+ '<class \'Exception\'>:method "this_is_not_exists" '
'is not supported')
except (xmlrpclib.ProtocolError, socket.error) as e:
# ignore failures due to non-blocking socket 'unavailable' errors