@@ -843,7 +843,7 @@ async def test_node_relay_and_power(self, monkeypatch: pytest.MonkeyPatch) -> No
843843
844844 # Test non-support relay configuration
845845 with pytest .raises (pw_exceptions .FeatureError ):
846- assert stick .nodes ["0098765432101234" ].relay_config
846+ stick .nodes ["0098765432101234" ].relay_config
847847 with pytest .raises (pw_exceptions .FeatureError ):
848848 await stick .nodes ["0098765432101234" ].set_relay_init (True )
849849 with pytest .raises (pw_exceptions .FeatureError ):
@@ -1903,7 +1903,7 @@ async def load_callback(event: pw_api.NodeEvent, mac: str) -> None: # type: ign
19031903 async def test_sed_node (self , monkeypatch : pytest .MonkeyPatch ) -> None : # noqa: PLR0915
19041904 """Testing properties of SED."""
19051905
1906- def fake_cache (dummy : object , setting : str ) -> str | bool | None : # noqa: PLR0911
1906+ def fake_cache (dummy : object , setting : str ) -> str | None : # noqa: PLR0911
19071907 """Fake cache retrieval."""
19081908 if setting == pw_node .CACHE_FIRMWARE :
19091909 return "2011-6-27-8-55-44"
@@ -1915,18 +1915,22 @@ def fake_cache(dummy: object, setting: str) -> str | bool | None: # noqa: PLR09
19151915 return "20"
19161916 if setting == pw_sed .CACHE_SED_CLOCK_INTERVAL :
19171917 return "12600"
1918- if setting == pw_sed .CACHE_SED_CLOCK_SYNC :
1919- return False
1920- if setting == pw_sed .CACHE_SED_DIRTY :
1921- return False
19221918 if setting == pw_sed .CACHE_SED_MAINTENANCE_INTERVAL :
19231919 return "60"
19241920 if setting == pw_sed .CACHE_SED_SLEEP_DURATION :
19251921 return "60"
19261922 return None
19271923
1924+ def fake_cache_bool (dummy : object , setting : str ) -> bool | None :
1925+ """Fake cache_bool retrieval."""
1926+ if setting in (pw_sed .CACHE_SED_CLOCK_SYNC , pw_sed .CACHE_SED_DIRTY ):
1927+ return False
1928+ return None
1929+
19281930 monkeypatch .setattr (pw_node .PlugwiseBaseNode , "_get_cache" , fake_cache )
1929- monkeypatch .setattr (pw_node .PlugwiseBaseNode , "_get_cache_as_bool" , fake_cache )
1931+ monkeypatch .setattr (
1932+ pw_node .PlugwiseBaseNode , "_get_cache_as_bool" , fake_cache_bool
1933+ )
19301934 mock_stick_controller = MockStickController ()
19311935
19321936 async def load_callback (event : pw_api .NodeEvent , mac : str ) -> None : # type: ignore[name-defined]
@@ -2099,7 +2103,7 @@ async def load_callback(event: pw_api.NodeEvent, mac: str) -> None: # type: ign
20992103 async def test_scan_node (self , monkeypatch : pytest .MonkeyPatch ) -> None : # noqa: PLR0915
21002104 """Testing properties of scan."""
21012105
2102- def fake_cache (dummy : object , setting : str ) -> str | bool | None : # noqa: PLR0911 PLR0912
2106+ def fake_cache (dummy : object , setting : str ) -> str | None : # noqa: PLR0911 PLR0912
21032107 """Fake cache retrieval."""
21042108 if setting == pw_node .CACHE_FIRMWARE :
21052109 return "2011-6-27-8-55-44"
@@ -2113,30 +2117,36 @@ def fake_cache(dummy: object, setting: str) -> str | bool | None: # noqa: PLR09
21132117 return "20"
21142118 if setting == pw_sed .CACHE_SED_CLOCK_INTERVAL :
21152119 return "12600"
2116- if setting == pw_sed .CACHE_SED_CLOCK_SYNC :
2117- return True
2118- if setting == pw_sed .CACHE_SED_DIRTY :
2119- return False
21202120 if setting == pw_sed .CACHE_SED_MAINTENANCE_INTERVAL :
21212121 return "60"
21222122 if setting == pw_sed .CACHE_SED_SLEEP_DURATION :
21232123 return "60"
2124- if setting == pw_scan .CACHE_SCAN_MOTION_STATE :
2125- return False
21262124 if setting == pw_scan .CACHE_SCAN_MOTION_TIMESTAMP :
21272125 return "2024-12-6-1-0-0"
21282126 if setting == pw_scan .CACHE_SCAN_CONFIG_RESET_TIMER :
21292127 return "10"
21302128 if setting == pw_scan .CACHE_SCAN_CONFIG_SENSITIVITY :
21312129 return "MEDIUM"
2132- if setting == pw_scan .CACHE_SCAN_CONFIG_DAYLIGHT_MODE :
2130+ return None
2131+
2132+ def fake_cache_bool (dummy : object , setting : str ) -> bool | None :
2133+ """Fake cache_bool retrieval."""
2134+ if setting == pw_sed .CACHE_SED_CLOCK_SYNC :
2135+ return True
2136+ if setting == pw_sed .CACHE_SED_DIRTY :
21332137 return False
2134- if setting == pw_scan .CACHE_SCAN_CONFIG_DIRTY :
2138+ if setting in (
2139+ pw_scan .CACHE_SCAN_MOTION_STATE ,
2140+ pw_scan .CACHE_SCAN_CONFIG_DAYLIGHT_MODE ,
2141+ pw_scan .CACHE_SCAN_CONFIG_DIRTY ,
2142+ ):
21352143 return False
21362144 return None
21372145
21382146 monkeypatch .setattr (pw_node .PlugwiseBaseNode , "_get_cache" , fake_cache )
2139- monkeypatch .setattr (pw_node .PlugwiseBaseNode , "_get_cache_as_bool" , fake_cache )
2147+ monkeypatch .setattr (
2148+ pw_node .PlugwiseBaseNode , "_get_cache_as_bool" , fake_cache_bool
2149+ )
21402150 mock_stick_controller = MockStickController ()
21412151 scan_config_accepted = pw_responses .NodeAckResponse ()
21422152 scan_config_accepted .deserialize (
@@ -2294,7 +2304,7 @@ async def load_callback(event: pw_api.NodeEvent, mac: str) -> None: # type: ign
22942304 async def test_switch_node (self , monkeypatch : pytest .MonkeyPatch ) -> None :
22952305 """Testing properties of switch."""
22962306
2297- def fake_cache (dummy : object , setting : str ) -> str | bool | None : # noqa: PLR0911
2307+ def fake_cache (dummy : object , setting : str ) -> str | None : # noqa: PLR0911
22982308 """Fake cache retrieval."""
22992309 if setting == pw_node .CACHE_FIRMWARE :
23002310 return "2011-5-13-7-26-54"
@@ -2308,18 +2318,22 @@ def fake_cache(dummy: object, setting: str) -> str | bool | None: # noqa: PLR09
23082318 return "15"
23092319 if setting == pw_sed .CACHE_SED_CLOCK_INTERVAL :
23102320 return "14600"
2311- if setting == pw_sed .CACHE_SED_CLOCK_SYNC :
2312- return False
23132321 if setting == pw_sed .CACHE_SED_MAINTENANCE_INTERVAL :
23142322 return "900"
23152323 if setting == pw_sed .CACHE_SED_SLEEP_DURATION :
23162324 return "180"
2317- if setting == pw_sed .CACHE_SED_DIRTY :
2325+ return None
2326+
2327+ def fake_cache_bool (dummy : object , setting : str ) -> bool | None :
2328+ """Fake cache_bool retrieval."""
2329+ if setting in (pw_sed .CACHE_SED_CLOCK_SYNC , pw_sed .CACHE_SED_DIRTY ):
23182330 return False
23192331 return None
23202332
23212333 monkeypatch .setattr (pw_node .PlugwiseBaseNode , "_get_cache" , fake_cache )
2322- monkeypatch .setattr (pw_node .PlugwiseBaseNode , "_get_cache_as_bool" , fake_cache )
2334+ monkeypatch .setattr (
2335+ pw_node .PlugwiseBaseNode , "_get_cache_as_bool" , fake_cache_bool
2336+ )
23232337 mock_stick_controller = MockStickController ()
23242338
23252339 async def load_callback (event : pw_api .NodeEvent , mac : str ) -> None : # type: ignore[name-defined]
@@ -2397,7 +2411,7 @@ async def test_node_discovery_and_load( # noqa: PLR0915
23972411 ) -> None :
23982412 """Testing discovery of nodes."""
23992413
2400- def fake_cache (dummy : object , setting : str ) -> str | bool | None : # noqa: PLR0911
2414+ def fake_cache (dummy : object , setting : str ) -> str | None : # noqa: PLR0911
24012415 """Fake cache retrieval."""
24022416 if setting == pw_node .CACHE_FIRMWARE :
24032417 return "2011-5-13-7-26-54"
@@ -2411,18 +2425,22 @@ def fake_cache(dummy: object, setting: str) -> str | bool | None: # noqa: PLR09
24112425 return "10"
24122426 if setting == pw_sed .CACHE_SED_CLOCK_INTERVAL :
24132427 return "25200"
2414- if setting == pw_sed .CACHE_SED_CLOCK_SYNC :
2415- return False
24162428 if setting == pw_sed .CACHE_SED_MAINTENANCE_INTERVAL :
24172429 return "60"
24182430 if setting == pw_sed .CACHE_SED_SLEEP_DURATION :
24192431 return "60"
2420- if setting == pw_sed .CACHE_SED_DIRTY :
2432+ return None
2433+
2434+ def fake_cache_bool (dummy : object , setting : str ) -> bool | None :
2435+ """Fake cache_bool retrieval."""
2436+ if setting in (pw_sed .CACHE_SED_CLOCK_SYNC , pw_sed .CACHE_SED_DIRTY ):
24212437 return False
24222438 return None
24232439
24242440 monkeypatch .setattr (pw_node .PlugwiseBaseNode , "_get_cache" , fake_cache )
2425- monkeypatch .setattr (pw_node .PlugwiseBaseNode , "_get_cache_as_bool" , fake_cache )
2441+ monkeypatch .setattr (
2442+ pw_node .PlugwiseBaseNode , "_get_cache_as_bool" , fake_cache_bool
2443+ )
24262444 mock_serial = MockSerial (None )
24272445 monkeypatch .setattr (
24282446 pw_connection_manager ,
0 commit comments