From 67b4dcf8ae58553030d06eb10ea36f91870b4bfe Mon Sep 17 00:00:00 2001 From: Peter Kuehne Date: Thu, 16 Jul 2020 08:50:06 +0100 Subject: [PATCH] Fix unit test warning for hypothesis deprecation (#1163) --- tests/unit_tests/test_core.py | 6 +++--- tests/unit_tests/test_helpers.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/unit_tests/test_core.py b/tests/unit_tests/test_core.py index 166a12c40e..27b64ec3d5 100644 --- a/tests/unit_tests/test_core.py +++ b/tests/unit_tests/test_core.py @@ -1,7 +1,7 @@ import pytest from hypothesis import given -from hypothesis.provisional import ip4_addr_strings +from hypothesis.provisional import ip_addresses from strategies import mac_addr_strings from esphome import core, const @@ -24,7 +24,7 @@ class TestHexInt: class TestIPAddress: - @given(value=ip4_addr_strings()) + @given(value=ip_addresses(v=4).map(str)) def test_init__valid(self, value): core.IPAddress(*value.split(".")) @@ -33,7 +33,7 @@ class TestIPAddress: with pytest.raises(ValueError, match="IPAddress must consist of 4 items"): core.IPAddress(*value.split(".")) - @given(value=ip4_addr_strings()) + @given(value=ip_addresses(v=4).map(str)) def test_str(self, value): target = core.IPAddress(*value.split(".")) diff --git a/tests/unit_tests/test_helpers.py b/tests/unit_tests/test_helpers.py index 3c0a96149d..6e89a05bc2 100644 --- a/tests/unit_tests/test_helpers.py +++ b/tests/unit_tests/test_helpers.py @@ -1,7 +1,7 @@ import pytest from hypothesis import given -from hypothesis.provisional import ip4_addr_strings +from hypothesis.provisional import ip_addresses from esphome import helpers @@ -75,7 +75,7 @@ def test_is_ip_address__invalid(host): assert actual is False -@given(value=ip4_addr_strings()) +@given(value=ip_addresses(v=4).map(str)) def test_is_ip_address__valid(value): actual = helpers.is_ip_address(value)