Spaces:
Runtime error
Runtime error
Download tests/test_render_assistant.py from Darshankumarr03/Swift-Query: direct link, hf CLI and curl.
- Browser
- Download file 863 Bytes
-
https://huggingface.co/spaces/Darshankumarr03/Swift-Query/resolve/main/tests/test_render_assistant.py
- Command line
-
hf download hf://spaces/Darshankumarr03/Swift-Query/tests/test_render_assistant.py
-
curl -L -o test_render_assistant.py https://huggingface.co/spaces/Darshankumarr03/Swift-Query/resolve/main/tests/test_render_assistant.py
863 Bytes
| from flask import Flask, render_template, session | |
| from utils.blueprints.assistant import assistant_bp | |
| import os | |
| app = Flask(__name__, template_folder='templates') | |
| app.config['SECRET_KEY'] = 'test' | |
| app.register_blueprint(assistant_bp) | |
| # Mock mongo? The template iterates "patients". | |
| # We can just render_template directly with calling the view function, or mock mongo. | |
| # Easiest is to manually render the template file in a standalone context. | |
| def test(): | |
| session['user_name'] = 'Test Assistant' | |
| patients = [{'id': 1, 'name': 'John Doe'}, {'id': 2, 'name': 'Jane Doe'}] | |
| try: | |
| return render_template('assistant/assistant_data_entry.html', patients=patients) | |
| except Exception as e: | |
| return f"ERROR: {e}" | |
| if __name__ == "__main__": | |
| with app.test_request_context('/test_render'): | |
| print(test()) | |