import builtins
import pytest
from jarvis import speech

def test_fallback(monkeypatch):
    monkeypatch.setattr(speech.sr, "Microphone", lambda: (_ for _ in ()).throw(OSError))
    monkeypatch.setattr(builtins, "input", lambda _: "fallback command")
    assert speech.recognize() == "fallback command"
