@@ -0,0 +1,1255 @@
+%22%22%22Test the VCNL4010 sensor helper.%22%22%22%0Afrom mock import patch, call, MagicMock%0A%0Afrom drivers.VCNL4010 import VCNL4010%0A%0A%0Adef test_init():%0A    %22%22%22Test the init, which configures the chip.%22%22%22%0A    mockbus = MagicMock()%0A    with patch('smbus.SMBus', return_value=mockbus) as mockSMbusModule:%0A        driver = VCNL4010(1, 2, 3, 4)%0A        mockSMbusModule.assert_called_once_with(1)%0A        assert driver.i2c_addr == 2%0A        assert driver.binary_threshold == 4%0A        expected_calls = %5B%0A            call(2, 0x83, 3)  # set LED current%0A        %5D%0A        mockbus.write_byte_data.assert_has_calls(expected_calls)%0A%0Adef test_get_is_high():%0A    %22%22%22Test the binary interpretation of the proximity value.%22%22%22%0A    mockbus = MagicMock()%0A    with patch('smbus.SMBus', return_value=mockbus):%0A        driver = VCNL4010(1, 2, 3, 258)%0A        # value larger than threshold means not high%0A        mockbus.read_i2c_block_data.return_value = %5B0, 0, 1, 3%5D  # lux MSB, lux LSB, prox MSB, prox LSB%0A        assert not driver.is_high()%0A        # value smaller than threshold means high%0A        mockbus.read_i2c_block_data.return_value = %5B0, 0, 1, 1%5D  # lux MSB, lux LSB, prox MSB, prox LSB%0A        assert driver.is_high()%0A        # value equal to threshold doesn't really concern us%0A

Add test for VCNL4010