import pytest from control_backend.schemas.ri_message import RIMessage, RIEndpoint, SpeechCommand from pydantic import ValidationError def valid_command_1(): return SpeechCommand(data="Hallo?") def invalid_command_1(): return RIMessage(endpoint=RIEndpoint.PING, data="Hello again.") def test_valid_speech_command_1(): command = valid_command_1() try: RIMessage.model_validate(command) SpeechCommand.model_validate(command) assert True except ValidationError: assert False def test_invalid_speech_command_1(): command = invalid_command_1() passed_ri_message_validation = False try: # Should succeed, still. RIMessage.model_validate(command) passed_ri_message_validation = True # Should fail. SpeechCommand.model_validate(command) assert False except ValidationError: assert passed_ri_message_validation