mirror of https://github.com/jab/bidict.git
rm PY2 vestige for namedbidict tests missed by #99.
This commit is contained in:
parent
3af1499708
commit
9bb1d88383
|
@ -7,14 +7,12 @@
|
||||||
|
|
||||||
"""Strategies for Hypothesis tests."""
|
"""Strategies for Hypothesis tests."""
|
||||||
|
|
||||||
import re
|
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
from operator import attrgetter, itemgetter
|
from operator import attrgetter, itemgetter
|
||||||
from os import getenv
|
from os import getenv
|
||||||
|
|
||||||
import hypothesis.strategies as st
|
import hypothesis.strategies as st
|
||||||
from bidict import DROP_NEW, DROP_OLD, RAISE, OnDup, OrderedBidictBase, namedbidict
|
from bidict import DROP_NEW, DROP_OLD, RAISE, OnDup, OrderedBidictBase, namedbidict
|
||||||
from bidict.compat import PY2
|
|
||||||
|
|
||||||
from . import _types as t
|
from . import _types as t
|
||||||
|
|
||||||
|
@ -74,11 +72,6 @@ MUTABLE_BIDICTS = _bidict_strat(MUTABLE_BIDICT_TYPES)
|
||||||
ORDERED_BIDICTS = _bidict_strat(ORDERED_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()]
|
_ALPHABET = [chr(i) for i in range(0x10ffff) if chr(i).isidentifier()]
|
||||||
_NAMEDBI_VALID_NAMES = st.text(_ALPHABET, min_size=1)
|
_NAMEDBI_VALID_NAMES = st.text(_ALPHABET, min_size=1)
|
||||||
IS_VALID_NAME = str.isidentifier
|
IS_VALID_NAME = str.isidentifier
|
||||||
|
|
Loading…
Reference in New Issue