From 9bb1d8838381752b6e64c822ba2fe12224b6d031 Mon Sep 17 00:00:00 2001 From: jab Date: Sat, 11 Jan 2020 17:29:53 +0000 Subject: [PATCH] rm PY2 vestige for namedbidict tests missed by #99. --- tests/properties/_strategies.py | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/tests/properties/_strategies.py b/tests/properties/_strategies.py index 5a8a03e..78aa512 100644 --- a/tests/properties/_strategies.py +++ b/tests/properties/_strategies.py @@ -7,14 +7,12 @@ """Strategies for Hypothesis tests.""" -import re from collections import OrderedDict from operator import attrgetter, itemgetter from os import getenv import hypothesis.strategies as st from bidict import DROP_NEW, DROP_OLD, RAISE, OnDup, OrderedBidictBase, namedbidict -from bidict.compat import PY2 from . import _types as t @@ -74,14 +72,9 @@ MUTABLE_BIDICTS = _bidict_strat(MUTABLE_BIDICT_TYPES) ORDERED_BIDICTS = _bidict_strat(ORDERED_BIDICT_TYPES) -if PY2: - _NAMEDBI_VALID_NAME_PAT = re.compile('[A-Za-z_][A-Za-z0-9_]*$') - _NAMEDBI_VALID_NAMES = st.from_regex(_NAMEDBI_VALID_NAME_PAT, fullmatch=True) - IS_VALID_NAME = _NAMEDBI_VALID_NAME_PAT.match -else: - _ALPHABET = [chr(i) for i in range(0x10ffff) if chr(i).isidentifier()] - _NAMEDBI_VALID_NAMES = st.text(_ALPHABET, min_size=1) - IS_VALID_NAME = str.isidentifier +_ALPHABET = [chr(i) for i in range(0x10ffff) if chr(i).isidentifier()] +_NAMEDBI_VALID_NAMES = st.text(_ALPHABET, min_size=1) +IS_VALID_NAME = str.isidentifier NAMEDBIDICT_NAMES_ALL_VALID = st.lists(_NAMEDBI_VALID_NAMES, min_size=3, max_size=3, unique=True) NAMEDBIDICT_NAMES_SOME_INVALID = st.lists(st.text(min_size=1), min_size=3, max_size=3).filter( lambda i: not all(IS_VALID_NAME(name) for name in i)