mirror of
				https://github.com/KevinMidboe/python-gpiozero.git
				synced 2025-10-29 17:50:37 +00:00 
			
		
		
		
	Fix statusboard tests
No point testing for invalid names (as they're not *really* invalid); also ensure tests requiring PWM using MockPWMPin
This commit is contained in:
		| @@ -30,6 +30,8 @@ def setup_function(function): | |||||||
|         'test_led_board_fade_background', |         'test_led_board_fade_background', | ||||||
|         'test_led_bar_graph_pwm_value', |         'test_led_bar_graph_pwm_value', | ||||||
|         'test_led_bar_graph_pwm_initial_value', |         'test_led_bar_graph_pwm_initial_value', | ||||||
|  |         'test_statusboard_kwargs', | ||||||
|  |         'test_statuszero_kwargs', | ||||||
|         ) else MockPin |         ) else MockPin | ||||||
|  |  | ||||||
| def teardown_function(function): | def teardown_function(function): | ||||||
| @@ -779,17 +781,7 @@ def test_energenie(): | |||||||
|         device1.close() |         device1.close() | ||||||
|         assert repr(device1) == '<gpiozero.Energenie object closed>' |         assert repr(device1) == '<gpiozero.Energenie object closed>' | ||||||
|  |  | ||||||
| def test_statuszero_bad_init(): | def test_statuszero_init(): | ||||||
|     with pytest.raises(ValueError): |  | ||||||
|         StatusZero('') |  | ||||||
|     with pytest.raises(ValueError): |  | ||||||
|         StatusZero('1') |  | ||||||
|     with pytest.raises(ValueError): |  | ||||||
|         StatusZero(1) |  | ||||||
|     with pytest.raises(ValueError): |  | ||||||
|         StatusZero('a', 'b', 'c', 'd') |  | ||||||
|  |  | ||||||
| def test_statuszero_good_init(): |  | ||||||
|     with StatusZero() as sz: |     with StatusZero() as sz: | ||||||
|         assert sz |         assert sz | ||||||
|     with StatusZero('a') as sz: |     with StatusZero('a') as sz: | ||||||
| @@ -830,17 +822,7 @@ def test_statuszero_named(): | |||||||
|         with pytest.raises(AttributeError): |         with pytest.raises(AttributeError): | ||||||
|             sz.one |             sz.one | ||||||
|  |  | ||||||
| def test_statusboard_bad_init(): | def test_statusboard_init(): | ||||||
|     with pytest.raises(ValueError): |  | ||||||
|         StatusBoard('') |  | ||||||
|     with pytest.raises(ValueError): |  | ||||||
|         StatusBoard('1') |  | ||||||
|     with pytest.raises(ValueError): |  | ||||||
|         StatusBoard(1) |  | ||||||
|     with pytest.raises(ValueError): |  | ||||||
|         StatusBoard('a', 'b', 'c', 'd', 'e', 'f') |  | ||||||
|  |  | ||||||
| def test_statusboard_good_init(): |  | ||||||
|     with StatusBoard() as sb: |     with StatusBoard() as sb: | ||||||
|         assert sb |         assert sb | ||||||
|     with StatusBoard('a') as sb: |     with StatusBoard('a') as sb: | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user