summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_defaultdict.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2020-06-21 08:11:17 (GMT)
committerGitHub <noreply@github.com>2020-06-21 08:11:17 (GMT)
commitf9bab74d5b34c64cf061e1629ff5f3092a4ca9b3 (patch)
tree6300c872eefba9992cebe7ec5efccaa8ea0d8347 /Lib/test/test_defaultdict.py
parent19fcffa92773e008e4f5efb80047420a0cfafeec (diff)
downloadcpython-f9bab74d5b34c64cf061e1629ff5f3092a4ca9b3.zip
cpython-f9bab74d5b34c64cf061e1629ff5f3092a4ca9b3.tar.gz
cpython-f9bab74d5b34c64cf061e1629ff5f3092a4ca9b3.tar.bz2
bpo-41055: Remove outdated tests for the tp_print slot. (GH-21006)
Diffstat (limited to 'Lib/test/test_defaultdict.py')
-rw-r--r--Lib/test/test_defaultdict.py33
1 files changed, 0 insertions, 33 deletions
diff --git a/Lib/test/test_defaultdict.py b/Lib/test/test_defaultdict.py
index b48c649..68fc449 100644
--- a/Lib/test/test_defaultdict.py
+++ b/Lib/test/test_defaultdict.py
@@ -72,27 +72,6 @@ class TestDefaultDict(unittest.TestCase):
d3[13]
self.assertEqual(repr(d3), "defaultdict(%s, {13: 43})" % repr(foo))
- def test_print(self):
- d1 = defaultdict()
- def foo(): return 42
- d2 = defaultdict(foo, {1: 2})
- # NOTE: We can't use tempfile.[Named]TemporaryFile since this
- # code must exercise the tp_print C code, which only gets
- # invoked for *real* files.
- tfn = tempfile.mktemp()
- try:
- f = open(tfn, "w+")
- try:
- print(d1, file=f)
- print(d2, file=f)
- f.seek(0)
- self.assertEqual(f.readline(), repr(d1) + "\n")
- self.assertEqual(f.readline(), repr(d2) + "\n")
- finally:
- f.close()
- finally:
- os.remove(tfn)
-
def test_copy(self):
d1 = defaultdict()
d2 = d1.copy()
@@ -160,18 +139,6 @@ class TestDefaultDict(unittest.TestCase):
r"sub\(<bound method .*sub\._factory "
r"of sub\(\.\.\., \{\}\)>, \{\}\)")
- # NOTE: printing a subclass of a builtin type does not call its
- # tp_print slot. So this part is essentially the same test as above.
- tfn = tempfile.mktemp()
- try:
- f = open(tfn, "w+")
- try:
- print(d, file=f)
- finally:
- f.close()
- finally:
- os.remove(tfn)
-
def test_callable_arg(self):
self.assertRaises(TypeError, defaultdict, {})