mirror of
https://github.com/python-kasa/python-kasa.git
synced 2024-12-22 11:13:34 +00:00
Enable ruff lint pycodestyle warnings (#1132)
Addresses repeated SyntaxWarnings when running linters: ``` kasa/tests/test_bulb.py:254: SyntaxWarning: invalid escape sequence '\d' ValueError, match="Temperature should be between \d+ and \d+, was 1000" kasa/tests/test_bulb.py:258: SyntaxWarning: invalid escape sequence '\d' ValueError, match="Temperature should be between \d+ and \d+, was 10000" kasa/tests/test_common_modules.py:216: SyntaxWarning: invalid escape sequence '\d' with pytest.raises(ValueError, match="Temperature should be between \d+ and \d+"): kasa/tests/test_common_modules.py:219: SyntaxWarning: invalid escape sequence '\d' with pytest.raises(ValueError, match="Temperature should be between \d+ and \d+"): ```
This commit is contained in:
parent
db686e191a
commit
936e45cad7
@ -251,11 +251,11 @@ async def test_out_of_range_temperature(dev: Device):
|
|||||||
light = dev.modules.get(Module.Light)
|
light = dev.modules.get(Module.Light)
|
||||||
assert light
|
assert light
|
||||||
with pytest.raises(
|
with pytest.raises(
|
||||||
ValueError, match="Temperature should be between \d+ and \d+, was 1000"
|
ValueError, match=r"Temperature should be between \d+ and \d+, was 1000"
|
||||||
):
|
):
|
||||||
await light.set_color_temp(1000)
|
await light.set_color_temp(1000)
|
||||||
with pytest.raises(
|
with pytest.raises(
|
||||||
ValueError, match="Temperature should be between \d+ and \d+, was 10000"
|
ValueError, match=r"Temperature should be between \d+ and \d+, was 10000"
|
||||||
):
|
):
|
||||||
await light.set_color_temp(10000)
|
await light.set_color_temp(10000)
|
||||||
|
|
||||||
|
@ -213,10 +213,10 @@ async def test_light_color_temp(dev: Device):
|
|||||||
assert light.color_temp == feature.minimum_value + 20
|
assert light.color_temp == feature.minimum_value + 20
|
||||||
assert light.brightness == 60
|
assert light.brightness == 60
|
||||||
|
|
||||||
with pytest.raises(ValueError, match="Temperature should be between \d+ and \d+"):
|
with pytest.raises(ValueError, match=r"Temperature should be between \d+ and \d+"):
|
||||||
await light.set_color_temp(feature.minimum_value - 10)
|
await light.set_color_temp(feature.minimum_value - 10)
|
||||||
|
|
||||||
with pytest.raises(ValueError, match="Temperature should be between \d+ and \d+"):
|
with pytest.raises(ValueError, match=r"Temperature should be between \d+ and \d+"):
|
||||||
await light.set_color_temp(feature.maximum_value + 10)
|
await light.set_color_temp(feature.maximum_value + 10)
|
||||||
|
|
||||||
|
|
||||||
|
@ -120,7 +120,8 @@ target-version = "py38"
|
|||||||
|
|
||||||
[tool.ruff.lint]
|
[tool.ruff.lint]
|
||||||
select = [
|
select = [
|
||||||
"E", # pycodestyle
|
"E", # pycodestyle errors
|
||||||
|
"W", # pycodestyle warnings
|
||||||
"D", # pydocstyle
|
"D", # pydocstyle
|
||||||
"F", # pyflakes
|
"F", # pyflakes
|
||||||
"UP", # pyupgrade
|
"UP", # pyupgrade
|
||||||
|
Loading…
Reference in New Issue
Block a user