mirror of
https://github.com/esphome/esphome.git
synced 2026-06-24 13:43:00 +00:00
[core] Enable ruff B (flake8-bugbear) lint family (#16655)
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
|
||||
from esphome.components.display import (
|
||||
DisplayMetaData,
|
||||
add_metadata,
|
||||
@@ -74,8 +76,5 @@ def test_add_metadata_overwrites_existing():
|
||||
def test_metadata_is_frozen():
|
||||
"""Test that DisplayMetaData instances are immutable (frozen dataclass)."""
|
||||
meta = DisplayMetaData(320, 240, True, False)
|
||||
try:
|
||||
with pytest.raises(AttributeError):
|
||||
meta.width = 640
|
||||
assert False, "Expected FrozenInstanceError"
|
||||
except AttributeError:
|
||||
pass
|
||||
|
||||
@@ -510,15 +510,9 @@ def test_package_merge_by_missing_id() -> None:
|
||||
],
|
||||
}
|
||||
|
||||
error_raised = False
|
||||
try:
|
||||
with pytest.raises(cv.Invalid) as exc_info:
|
||||
packages_pass(config)
|
||||
assert False, "Expected validation error for missing ID"
|
||||
except cv.Invalid as err:
|
||||
error_raised = True
|
||||
assert err.path == [CONF_SENSOR, 2]
|
||||
|
||||
assert error_raised
|
||||
assert exc_info.value.path == [CONF_SENSOR, 2]
|
||||
|
||||
|
||||
def test_package_list_remove_by_id() -> None:
|
||||
|
||||
Reference in New Issue
Block a user