def test_constructor(): info = StripInfo() assert info.num_leds == 0 assert info.pin is None assert info.image_debugging is False assert info.file_name is None assert info.renders_before_save is None assert info.thread_count == 100
def test_pin(caplog): info = StripInfo() info.pin = 10 assert info.check_data_types() is True info.pin = None assert info.check_data_types() is True info.pin = 1.0 with mock.patch('animatedledstrip.global_vars.STRICT_TYPE_CHECKING', False): assert info.check_data_types() is False log_messages = {(log.msg, log.levelname) for log in caplog.records} assert log_messages == {( "Bad data type for pin: <class 'float'> (should be <class 'int'> or None)", 'ERROR')} try: info.check_data_types() raise AssertionError except TypeError: pass