Update deprecated usages of hypothesis

This commit is contained in:
Hugo Osvaldo Barrera 2024-12-09 01:28:28 +01:00
parent 2e7e31fdbf
commit 688d6f907f
5 changed files with 7 additions and 9 deletions

View file

@ -1,4 +1,4 @@
hypothesis>=5.0.0,<7.0.0 hypothesis>=6.72.0,<7.0.0
pytest pytest
pytest-cov pytest-cov
pytest-httpserver pytest-httpserver

View file

@ -103,10 +103,8 @@ X-SOMETHING:{r}
HAHA:YES HAHA:YES
END:FOO""" END:FOO"""
printable_characters_strategy = st.text( printable_characters_strategy = st.text(st.characters(exclude_categories=("Cc", "Cs")))
st.characters(blacklist_categories=("Cc", "Cs"))
)
uid_strategy = st.text( uid_strategy = st.text(
st.characters(blacklist_categories=("Zs", "Zl", "Zp", "Cc", "Cs")), min_size=1 st.characters(exclude_categories=("Zs", "Zl", "Zp", "Cc", "Cs")), min_size=1
).filter(lambda x: x.strip() == x) ).filter(lambda x: x.strip() == x)

View file

@ -45,7 +45,7 @@ settings.register_profile(
"deterministic", "deterministic",
settings( settings(
derandomize=True, derandomize=True,
suppress_health_check=HealthCheck.all(), suppress_health_check=list(HealthCheck),
), ),
) )
settings.register_profile("dev", settings(suppress_health_check=[HealthCheck.too_slow])) settings.register_profile("dev", settings(suppress_health_check=[HealthCheck.too_slow]))

View file

@ -17,7 +17,7 @@ from vdirsyncer.vobject import Item
@given(uid=uid_strategy) @given(uid=uid_strategy)
# Using the random module for UIDs: # Using the random module for UIDs:
@settings(suppress_health_check=HealthCheck.all()) @settings(suppress_health_check=list(HealthCheck))
@pytest.mark.asyncio @pytest.mark.asyncio
async def test_repair_uids(uid): async def test_repair_uids(uid):
s = MemoryStorage() s = MemoryStorage()
@ -40,7 +40,7 @@ async def test_repair_uids(uid):
@given(uid=uid_strategy.filter(lambda x: not href_safe(x))) @given(uid=uid_strategy.filter(lambda x: not href_safe(x)))
# Using the random module for UIDs: # Using the random module for UIDs:
@settings(suppress_health_check=HealthCheck.all()) @settings(suppress_health_check=list(HealthCheck))
@pytest.mark.asyncio @pytest.mark.asyncio
async def test_repair_unsafe_uids(uid): async def test_repair_unsafe_uids(uid):
s = MemoryStorage() s = MemoryStorage()

View file

@ -299,7 +299,7 @@ def test_input_types():
value_strategy = st.text( value_strategy = st.text(
st.characters( st.characters(
blacklist_categories=("Zs", "Zl", "Zp", "Cc", "Cs"), blacklist_characters=":=" exclude_categories=("Zs", "Zl", "Zp", "Cc", "Cs"), exclude_characters=":="
), ),
min_size=1, min_size=1,
).filter(lambda x: x.strip() == x) ).filter(lambda x: x.strip() == x)