File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33import pytest
44
55from blinkstick .colors import ColorFormat
6- from blinkstick .enums import BlinkStickVariant
6+ from blinkstick .enums import BlinkStickVariant , Mode
77from blinkstick .clients .blinkstick import BlinkStick
88from pytest_mock import MockFixture
99
@@ -310,3 +310,26 @@ def test_inverse_does_not_affect_max_rgb_value(make_blinkstick):
310310 bs .set_max_rgb_value (100 )
311311 bs .set_inverse (True )
312312 assert bs .get_max_rgb_value () == 100
313+
314+
315+ @pytest .mark .parametrize (
316+ "mode, is_valid" ,
317+ [
318+ (1 , True ),
319+ (2 , True ),
320+ (3 , True ),
321+ (4 , False ),
322+ (- 1 , False ),
323+ (Mode .RGB , True ),
324+ (Mode .RGB_INVERSE , True ),
325+ (Mode .ADDRESSABLE , True ),
326+ ],
327+ )
328+ def test_set_mode_raises_on_invalid_mode (make_blinkstick , mode , is_valid ):
329+ """Test that set_mode raises an exception when an invalid mode is passed."""
330+ bs = make_blinkstick ()
331+ if is_valid :
332+ bs .set_mode (mode )
333+ else :
334+ with pytest .raises (ValueError ):
335+ bs .set_mode ("invalid_mode" ) # noqa
You can’t perform that action at this time.
0 commit comments