-
-
Notifications
You must be signed in to change notification settings - Fork 596
Closed
Labels
Description
Describe the bug
The test_set_property_by[value_type4-1] broke on Python 3.13, but works on 3.12.
Visible in the CI: https://github.com/rytilahti/python-miio/actions/runs/11759608046/job/32759267643
Version information (please complete the following information):
- OS: Linux
- python-miio: 0.5.12
To Reproduce
Steps to reproduce the behavior:
- Run the testsuite
Expected behavior
Home Assistant requires Python 3.13 by Feb 2025, so I hope that the python-miio test suite works with 3.13.
Console output
_____________________ test_set_property_by[value_type4-1] ______________________
dev = <MiotDevice: 127.0.0.1 (token: 68ffffffffffffffffffffffffffffff)>
value_type = functools.partial(<function MiotValueType._str2bool at 0x7ffff54b9ee0>)
value = '1'
@pytest.mark.parametrize(
"value_type,value",
[
(None, 1),
(MiotValueType.Int, "1"),
(MiotValueType.Float, "1.2"),
(MiotValueType.Str, "str"),
(MiotValueType.Bool, "1"),
],
)
def test_set_property_by(dev, value_type, value):
siid = 1
piid = 1
> _ = dev.set_property_by(siid, piid, value, value_type)
miio/tests/test_miotdevice.py:61:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
miio/click_common.py:184: in _wrap
return func(self, *args, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <MiotDevice: 127.0.0.1 (token: 68ffffffffffffffffffffffffffffff)>
siid = 1, piid = 1, value = '1'
value_type = functools.partial(<function MiotValueType._str2bool at 0x7ffff54b9ee0>)
@command(
click.argument("siid", type=int),
click.argument("piid", type=int),
click.argument("value"),
click.argument(
"value_type", type=EnumType(MiotValueType), required=False, default=None
),
)
def set_property_by(
self,
siid: int,
piid: int,
value: Union[int, float, str, bool],
value_type: Any = None,
):
"""Set a single property (siid/piid) to given value.
value_type can be given to convert the value to wanted type, allowed types are:
int, float, bool, str
"""
if value_type is not None:
> value = value_type.value(value)
E AttributeError: 'functools.partial' object has no attribute 'value'
miio/miot_device.py:142: AttributeError