mirror of
https://github.com/esphome/esphome.git
synced 2024-11-25 12:15:33 +01:00
Fix unit test warning for hypothesis deprecation (#1163)
This commit is contained in:
parent
ad91362571
commit
67b4dcf8ae
@ -1,7 +1,7 @@
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from hypothesis import given
|
from hypothesis import given
|
||||||
from hypothesis.provisional import ip4_addr_strings
|
from hypothesis.provisional import ip_addresses
|
||||||
from strategies import mac_addr_strings
|
from strategies import mac_addr_strings
|
||||||
|
|
||||||
from esphome import core, const
|
from esphome import core, const
|
||||||
@ -24,7 +24,7 @@ class TestHexInt:
|
|||||||
|
|
||||||
|
|
||||||
class TestIPAddress:
|
class TestIPAddress:
|
||||||
@given(value=ip4_addr_strings())
|
@given(value=ip_addresses(v=4).map(str))
|
||||||
def test_init__valid(self, value):
|
def test_init__valid(self, value):
|
||||||
core.IPAddress(*value.split("."))
|
core.IPAddress(*value.split("."))
|
||||||
|
|
||||||
@ -33,7 +33,7 @@ class TestIPAddress:
|
|||||||
with pytest.raises(ValueError, match="IPAddress must consist of 4 items"):
|
with pytest.raises(ValueError, match="IPAddress must consist of 4 items"):
|
||||||
core.IPAddress(*value.split("."))
|
core.IPAddress(*value.split("."))
|
||||||
|
|
||||||
@given(value=ip4_addr_strings())
|
@given(value=ip_addresses(v=4).map(str))
|
||||||
def test_str(self, value):
|
def test_str(self, value):
|
||||||
target = core.IPAddress(*value.split("."))
|
target = core.IPAddress(*value.split("."))
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from hypothesis import given
|
from hypothesis import given
|
||||||
from hypothesis.provisional import ip4_addr_strings
|
from hypothesis.provisional import ip_addresses
|
||||||
|
|
||||||
from esphome import helpers
|
from esphome import helpers
|
||||||
|
|
||||||
@ -75,7 +75,7 @@ def test_is_ip_address__invalid(host):
|
|||||||
assert actual is False
|
assert actual is False
|
||||||
|
|
||||||
|
|
||||||
@given(value=ip4_addr_strings())
|
@given(value=ip_addresses(v=4).map(str))
|
||||||
def test_is_ip_address__valid(value):
|
def test_is_ip_address__valid(value):
|
||||||
actual = helpers.is_ip_address(value)
|
actual = helpers.is_ip_address(value)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user