From 1e34ae0a242291c7a1ea22a5ff761621cb4eb789 Mon Sep 17 00:00:00 2001 From: jab Date: Sun, 14 Apr 2019 21:16:11 +0000 Subject: [PATCH] Use ItemsView in _bidict_and_mapping_from_items when not same_items for portability. e.g. on PyPy: >>>> b = bidict({1: 2, 3: 4}) >>>> b.items() [(1, 2), (3, 4)] >>>> m = {3: 4, 1: 2} >>>> m.items() [(3, 4), (1, 2)] >>>> b.items() == m.items() False >>>> ItemsView(b) == ItemsView(m) True --- tests/hypothesis/_strategies.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/hypothesis/_strategies.py b/tests/hypothesis/_strategies.py index 41e0c11..8f98780 100644 --- a/tests/hypothesis/_strategies.py +++ b/tests/hypothesis/_strategies.py @@ -12,7 +12,7 @@ from collections import OrderedDict from hypothesis import assume, strategies as st from bidict import IGNORE, OVERWRITE, RAISE, OrderedBidictBase, namedbidict -from bidict.compat import PY2, izip +from bidict.compat import ItemsView, PY2, izip import _types as t @@ -186,7 +186,7 @@ def _bidict_and_mapping_from_items( b = bi_cls(bi_items_) m = map_cls(map_items_) if not same_items: - assume(m.items() != b.items()) + assume(ItemsView(m) != ItemsView(b)) return b, m