Skip to content

Commit 0637e23

Browse files
committed
remove asserts combined with pytest.raises
1 parent e2f1903 commit 0637e23

File tree

1 file changed

+24
-24
lines changed

1 file changed

+24
-24
lines changed

tests/test_usb.py

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1808,28 +1808,28 @@ async def load_callback(event: pw_api.NodeEvent, mac: str) -> None: # type: ign
18081808

18091809
# Validate to raise exception when node is not yet loaded
18101810
with pytest.raises(pw_exceptions.NodeError):
1811-
assert await test_node.set_awake_duration(5) is not None
1811+
await test_node.set_awake_duration(5) is not None
18121812

18131813
with pytest.raises(pw_exceptions.NodeError):
1814-
assert test_node.battery_config is not None
1814+
test_node.battery_config is not None
18151815

18161816
with pytest.raises(pw_exceptions.NodeError):
1817-
assert await test_node.set_clock_interval(5) is not None
1817+
await test_node.set_clock_interval(5) is not None
18181818

18191819
with pytest.raises(pw_exceptions.NodeError):
1820-
assert await test_node.set_clock_sync(False) is not None
1820+
await test_node.set_clock_sync(False) is not None
18211821

18221822
with pytest.raises(pw_exceptions.NodeError):
1823-
assert await test_node.set_sleep_duration(5) is not None
1823+
await test_node.set_sleep_duration(5) is not None
18241824

18251825
with pytest.raises(pw_exceptions.NodeError):
1826-
assert await test_node.set_motion_daylight_mode(True) is not None
1826+
await test_node.set_motion_daylight_mode(True) is not None
18271827

18281828
with pytest.raises(pw_exceptions.NodeError):
1829-
assert await test_node.set_motion_sensitivity_level(20) is not None
1829+
test_node.set_motion_sensitivity_level(20) is not None
18301830

18311831
with pytest.raises(pw_exceptions.NodeError):
1832-
assert await test_node.set_motion_reset_timer(5) is not None
1832+
await test_node.set_motion_reset_timer(5) is not None
18331833

18341834
# Validate to raise NotImplementedError calling load() at basenode
18351835
with pytest.raises(NotImplementedError):
@@ -1839,54 +1839,54 @@ async def load_callback(event: pw_api.NodeEvent, mac: str) -> None: # type: ign
18391839

18401840
# Validate to raise exception when feature is not supported
18411841
with pytest.raises(pw_exceptions.FeatureError):
1842-
assert await test_node.set_awake_duration(5) is not None
1842+
await test_node.set_awake_duration(5) is not None
18431843

18441844
with pytest.raises(pw_exceptions.FeatureError):
1845-
assert test_node.battery_config is not None
1845+
test_node.battery_config is not None
18461846

18471847
with pytest.raises(pw_exceptions.FeatureError):
1848-
assert await test_node.set_clock_interval(5) is not None
1848+
await test_node.set_clock_interval(5) is not None
18491849

18501850
with pytest.raises(pw_exceptions.FeatureError):
1851-
assert await test_node.set_clock_sync(False) is not None
1851+
await test_node.set_clock_sync(False) is not None
18521852

18531853
with pytest.raises(pw_exceptions.FeatureError):
1854-
assert await test_node.set_sleep_duration(5) is not None
1854+
await test_node.set_sleep_duration(5) is not None
18551855

18561856
with pytest.raises(pw_exceptions.FeatureError):
1857-
assert await test_node.set_motion_daylight_mode(True) is not None
1857+
await test_node.set_motion_daylight_mode(True) is not None
18581858

18591859
with pytest.raises(pw_exceptions.FeatureError):
1860-
assert await test_node.set_motion_sensitivity_level(20) is not None
1860+
await test_node.set_motion_sensitivity_level(20) is not None
18611861

18621862
with pytest.raises(pw_exceptions.FeatureError):
1863-
assert await test_node.set_motion_reset_timer(5) is not None
1863+
await test_node.set_motion_reset_timer(5) is not None
18641864

18651865
# Add battery feature to test raising not implemented
18661866
# for battery related properties
18671867
test_node._features += (pw_api.NodeFeature.BATTERY,) # pylint: disable=protected-access
18681868
with pytest.raises(NotImplementedError):
1869-
assert await test_node.set_awake_duration(5) is not None
1869+
await test_node.set_awake_duration(5) is not None
18701870

18711871
with pytest.raises(NotImplementedError):
1872-
assert test_node.battery_config is not None
1872+
test_node.battery_config is not None
18731873

18741874
with pytest.raises(NotImplementedError):
1875-
assert await test_node.set_clock_interval(5) is not None
1875+
await test_node.set_clock_interval(5) is not None
18761876

18771877
with pytest.raises(NotImplementedError):
1878-
assert await test_node.set_clock_sync(False) is not None
1878+
await test_node.set_clock_sync(False) is not None
18791879

18801880
with pytest.raises(NotImplementedError):
1881-
assert await test_node.set_sleep_duration(5) is not None
1881+
await test_node.set_sleep_duration(5) is not None
18821882

18831883
test_node._features += (pw_api.NodeFeature.MOTION,) # pylint: disable=protected-access
18841884
with pytest.raises(NotImplementedError):
1885-
assert await test_node.set_motion_daylight_mode(True) is not None
1885+
await test_node.set_motion_daylight_mode(True) is not None
18861886
with pytest.raises(NotImplementedError):
1887-
assert await test_node.set_motion_sensitivity_level(20) is not None
1887+
await test_node.set_motion_sensitivity_level(20) is not None
18881888
with pytest.raises(NotImplementedError):
1889-
assert await test_node.set_motion_reset_timer(5) is not None
1889+
await test_node.set_motion_reset_timer(5) is not None
18901890

18911891
assert not test_node.cache_enabled
18921892
assert test_node.mac == "1298347650AFBECD"

0 commit comments

Comments
 (0)