Spaces:
Runtime error
Runtime error
Download tests/test_app.py from mimipynb/naomi: direct link, hf CLI and curl.
- Browser
- Download file 1.07 kB
-
https://huggingface.co/spaces/mimipynb/naomi/resolve/main/tests/test_app.py
- Command line
-
hf download hf://spaces/mimipynb/naomi/tests/test_app.py
-
curl -L -o test_app.py https://huggingface.co/spaces/mimipynb/naomi/resolve/main/tests/test_app.py
1.07 kB
| """ | |
| test_app.py | |
| Tests the main application. | |
| """ | |
| import warnings | |
| import pytest | |
| import streamlit as st | |
| from streamlit.testing.v1 import AppTest | |
| from app import open_intake_form | |
| warnings.filterwarnings("ignore", message="missing ScriptRunContext") | |
| warnings.filterwarnings("ignore", category=DeprecationWarning, message=".*custom tp_new.*") | |
| intake_form = [ | |
| 'candidate_name', | |
| 'candidate_contact_type', | |
| 'candidate_contact', | |
| 'candidate_dob', | |
| 'candidate_location', | |
| 'intake_submission' | |
| ] | |
| def app(): | |
| return AppTest.from_file('app.py').run() | |
| def form(): | |
| form = AppTest.from_function(open_intake_form).run() | |
| form.session_state.open_intake = True | |
| for key in intake_form: | |
| form.session_state[key] = None | |
| return form | |
| def test_new_session(app): | |
| assert 'messages' in app.session_state, f"`messages` not found in session state" | |
| def test_open_intake_button(app): | |
| # Simulate entering details | |
| app.button(key='open_intake').click() | |
| assert 'open_intake' in app.session_state | |