lundi 29 juin 2020

Why cant Python package hypothesis_regex find attribute 'defines_strategy' in hypothesis.strategies?

I am using hypothesis-5.18.3 and hypothesis-regex-0.3.1 in my python test to generate strings.

My code looks like this:

from hypothesis import given
from hypothesis_regex import regex

@given(regex(r"^[0-9]$"))
def test_functions_with_different_params(num):
...

The second line fails to import hypothesis_regex

File "...Python\Python38\lib\site-packages\hypothesis_regex.py", line 143, in <module>
@hs.defines_strategy
AttributeError: module 'hypothesis.strategies' has no attribute 'defines_strategy'

Is there a version mismatch between hypothesis and hypothesis_regex? I couldn't find any details in the documentation. I tried uninstalling both packages and installed the dependency via hypothesis_regex. Still the same error. Did anyone face this issue?

Aucun commentaire:

Enregistrer un commentaire