diff options
author | Raymond Hettinger <python@rcn.com> | 2011-02-23 00:46:28 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2011-02-23 00:46:28 (GMT) |
commit | 57d1a887e7f99d596a9b083592f7734f7ee1a11c (patch) | |
tree | 81ff8ffa4529a16aef99084eb124b264888012e0 /Lib/test | |
parent | bd475115c4fb0dda55f3d1f4443bff58abd1203f (diff) | |
download | cpython-57d1a887e7f99d596a9b083592f7734f7ee1a11c.zip cpython-57d1a887e7f99d596a9b083592f7734f7ee1a11c.tar.gz cpython-57d1a887e7f99d596a9b083592f7734f7ee1a11c.tar.bz2 |
Fix imports from collections.abc
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/support.py | 4 | ||||
-rw-r--r-- | Lib/test/test_collections.py | 17 | ||||
-rw-r--r-- | Lib/test/test_nntplib.py | 4 | ||||
-rw-r--r-- | Lib/test/test_shelve.py | 2 | ||||
-rw-r--r-- | Lib/test/test_xmlrpc_net.py | 4 |
5 files changed, 16 insertions, 15 deletions
diff --git a/Lib/test/support.py b/Lib/test/support.py index 9300aae..63c5569 100644 --- a/Lib/test/support.py +++ b/Lib/test/support.py @@ -15,7 +15,7 @@ import shutil import warnings import unittest import importlib -import collections +import collections.abc import re import subprocess import imp @@ -682,7 +682,7 @@ class CleanImport(object): sys.modules.update(self.original_modules) -class EnvironmentVarGuard(collections.MutableMapping): +class EnvironmentVarGuard(collections.abc.MutableMapping): """Class to help protect the environment variable properly. Can be used as a context manager.""" diff --git a/Lib/test/test_collections.py b/Lib/test/test_collections.py index d785fcb..4eaa091 100644 --- a/Lib/test/test_collections.py +++ b/Lib/test/test_collections.py @@ -10,12 +10,13 @@ from random import randrange, shuffle import keyword import re import sys -from collections import Hashable, Iterable, Iterator -from collections import Sized, Container, Callable -from collections import Set, MutableSet -from collections import Mapping, MutableMapping, KeysView, ItemsView, UserDict -from collections import Sequence, MutableSequence -from collections import ByteString +from collections import UserDict +from collections.abc import Hashable, Iterable, Iterator +from collections.abc import Sized, Container, Callable +from collections.abc import Set, MutableSet +from collections.abc import Mapping, MutableMapping, KeysView, ItemsView +from collections.abc import Sequence, MutableSequence +from collections.abc import ByteString TestNT = namedtuple('TestNT', 'x y z') # type used for pickle tests @@ -507,7 +508,7 @@ class TestCollectionABCs(ABCTestCase): def test_issue_4920(self): # MutableSet.pop() method did not work - class MySet(collections.MutableSet): + class MySet(MutableSet): __slots__=['__s'] def __init__(self,items=None): if items is None: @@ -553,7 +554,7 @@ class TestCollectionABCs(ABCTestCase): self.assertTrue(issubclass(sample, Mapping)) self.validate_abstract_methods(Mapping, '__contains__', '__iter__', '__len__', '__getitem__') - class MyMapping(collections.Mapping): + class MyMapping(Mapping): def __len__(self): return 0 def __getitem__(self, i): diff --git a/Lib/test/test_nntplib.py b/Lib/test/test_nntplib.py index a387f61..4577ddb 100644 --- a/Lib/test/test_nntplib.py +++ b/Lib/test/test_nntplib.py @@ -4,7 +4,7 @@ import textwrap import unittest import functools import contextlib -import collections +import collections.abc from test import support from nntplib import NNTP, GroupInfo, _have_ssl import nntplib @@ -246,7 +246,7 @@ class NetworkedNNTPTestsMixin: if not name.startswith('test_'): continue meth = getattr(cls, name) - if not isinstance(meth, collections.Callable): + if not isinstance(meth, collections.abc.Callable): continue # Need to use a closure so that meth remains bound to its current # value diff --git a/Lib/test/test_shelve.py b/Lib/test/test_shelve.py index 3e73f52..c9c0067 100644 --- a/Lib/test/test_shelve.py +++ b/Lib/test/test_shelve.py @@ -2,7 +2,7 @@ import unittest import shelve import glob from test import support -from collections import MutableMapping +from collections.abc import MutableMapping from test.test_dbm import dbm_iterator def L1(s): diff --git a/Lib/test/test_xmlrpc_net.py b/Lib/test/test_xmlrpc_net.py index 5df79f0..b9853ed 100644 --- a/Lib/test/test_xmlrpc_net.py +++ b/Lib/test/test_xmlrpc_net.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 -import collections +import collections.abc import errno import socket import sys @@ -48,7 +48,7 @@ class CurrentTimeTest(unittest.TestCase): # Perform a minimal sanity check on the result, just to be sure # the request means what we think it means. - self.assertIsInstance(builders, collections.Sequence) + self.assertIsInstance(builders, collections.abc.Sequence) self.assertTrue([x for x in builders if "3.x" in x], builders) |