1
0
mirror of https://github.com/esphome/esphome.git synced 2024-10-06 19:00:59 +01:00
esphome/tests/unit_tests/strategies.py

15 lines
494 B
Python
Raw Normal View History

import hypothesis.strategies._internal.core as st
from hypothesis.strategies._internal.strategies import SearchStrategy
@st.defines_strategy(force_reusable_values=True)
2022-10-05 08:09:27 +01:00
def mac_addr_strings() -> SearchStrategy[str]:
"""A strategy for MAC address strings.
This consists of six strings representing integers [0..255],
without zero-padding, joined by dots.
"""
return st.builds(
"{:02X}:{:02X}:{:02X}:{:02X}:{:02X}:{:02X}".format, *(6 * [st.integers(0, 255)])
)