From 02556fbade5e1e864dd09d5768a8dbbf5b3a0dac Mon Sep 17 00:00:00 2001 From: Raymond Hettinger Date: Thu, 11 Jan 2018 21:53:49 -0800 Subject: bpo-32467: Let collections.abc.ValuesView inherit from Collection (#5152) --- Lib/_collections_abc.py | 2 +- Lib/test/test_collections.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'Lib') diff --git a/Lib/_collections_abc.py b/Lib/_collections_abc.py index a5c7bfcda1d..dbe30dff1fe 100644 --- a/Lib/_collections_abc.py +++ b/Lib/_collections_abc.py @@ -746,7 +746,7 @@ def __iter__(self): ItemsView.register(dict_items) -class ValuesView(MappingView): +class ValuesView(MappingView, Collection): __slots__ = () diff --git a/Lib/test/test_collections.py b/Lib/test/test_collections.py index cb662355bb7..a55239e5730 100644 --- a/Lib/test/test_collections.py +++ b/Lib/test/test_collections.py @@ -843,13 +843,13 @@ def test_Collection(self): self.assertFalse(issubclass(type(x), Collection), repr(type(x))) # Check some non-collection iterables non_col_iterables = [_test_gen(), iter(b''), iter(bytearray()), - (x for x in []), dict().values()] + (x for x in [])] for x in non_col_iterables: self.assertNotIsInstance(x, Collection) self.assertFalse(issubclass(type(x), Collection), repr(type(x))) # Check some collections samples = [set(), frozenset(), dict(), bytes(), str(), tuple(), - list(), dict().keys(), dict().items()] + list(), dict().keys(), dict().items(), dict().values()] for x in samples: self.assertIsInstance(x, Collection) self.assertTrue(issubclass(type(x), Collection), repr(type(x))) -- cgit v1.2.3-65-gdbad