tikal.mock package
Submodules
tikal.mock.mock_lovense module
Private Mock: Used to simulate Lovense Devices for testing.
- class tikal.mock.mock_lovense.MockBLEDevice(name: str, address: str)[source]
Bases:
objectMock a BLE device that simulates discovered toys
- class tikal.mock.mock_lovense.MockBehavior(*values)[source]
Bases:
EnumDefines different toy simulation behaviors for testing
- CONNECTION_FAILURE = 'connection_failure'
- NORMAL = 'normal'
- POWER_OFF = 'power_off'
- class tikal.mock.mock_lovense.MockBleakClient(device: MockBLEDevice, disconnected_callback: Callable[[Any], Any])[source]
Bases:
objectMock BLE client that simulates Lovense toy communication.
Supports different behaviors based on device name: - Normal operation: Responds to all commands - connection_failure: Stops responding 5s after the first intensity command - POWEROFF: Sends POWEROFF and disconnects 5s after the first intensity command
- property is_connected: bool
Check connection status
- static is_intensity_command(command: str) bool[source]
Check if the command is an intensity command
- property services: list[MockService]
Return mock GATT services
- class tikal.mock.mock_lovense.MockBleakScanner(detection_callback: Callable[[MockBLEDevice, Any], None] | None = None)[source]
Bases:
objectMock BLE scanner that returns predefined toy configurations.
Tracks connected devices globally to simulate real Bluetooth behavior where connected devices stop advertising and don’t appear in scan results.
- async static discover(timeout: float) list[MockBLEDevice][source]
One-shot discovery: returns a list of mock devices that are not currently connected.
- Parameters:
timeout – Simulated scan duration (ignored except for a small delay).
- Returns:
List of MockBLEDevice objects for non-connected toys.
- classmethod register_connection(address: str) None[source]
Register a device as connected (will be excluded from scan results)
- class tikal.mock.mock_lovense.MockCharacteristic(uuid: str)[source]
Bases:
objectMock GATT characteristic that matches bleak’s BleakGATTCharacteristic interface
- class tikal.mock.mock_lovense.MockService(uuid: str, characteristics: list[MockCharacteristic])[source]
Bases:
objectMock GATT service that matches bleak’s BleakGATTService interface
Module contents
- class tikal.mock.MockBleakClient(device: MockBLEDevice, disconnected_callback: Callable[[Any], Any])[source]
Bases:
objectMock BLE client that simulates Lovense toy communication.
Supports different behaviors based on device name: - Normal operation: Responds to all commands - connection_failure: Stops responding 5s after the first intensity command - POWEROFF: Sends POWEROFF and disconnects 5s after the first intensity command
- property is_connected: bool
Check connection status
- static is_intensity_command(command: str) bool[source]
Check if the command is an intensity command
- property services: list[MockService]
Return mock GATT services
- class tikal.mock.MockBleakScanner(detection_callback: Callable[[MockBLEDevice, Any], None] | None = None)[source]
Bases:
objectMock BLE scanner that returns predefined toy configurations.
Tracks connected devices globally to simulate real Bluetooth behavior where connected devices stop advertising and don’t appear in scan results.
- async static discover(timeout: float) list[MockBLEDevice][source]
One-shot discovery: returns a list of mock devices that are not currently connected.
- Parameters:
timeout – Simulated scan duration (ignored except for a small delay).
- Returns:
List of MockBLEDevice objects for non-connected toys.
- classmethod register_connection(address: str) None[source]
Register a device as connected (will be excluded from scan results)