from pathlib import Path


def test_manual_correction_state_handles_lock_errors_without_500():
    text = Path("app/admin_ui/pages/opportunities.py").read_text()
    assert "from sqlalchemy.exc import OperationalError" in text
    assert "deadlock detected" in text
    assert "lock_timeout" in text
    assert "temporariamente indisponíveis" in text
    assert "time.sleep(0.25)" in text
