'Test the response from the socket and set it as the state.'

@patch('socket.socket')
@patch('select.select', return_value=(True, False, False))
def test_update_receives_packet_and_sets_as_state(self, mock_select, mock_socket):

    test_value = 'test_value'
    mock_socket = mock_socket().__enter__()
    mock_socket.recv.return_value = test_value.encode()
    config = copy(TEST_CONFIG['sensor'])
    del config[tcp.CONF_VALUE_TEMPLATE]
    sensor = tcp.TcpSensor(self.hass, config)
    assert (sensor._state == test_value)
