Download tests/test_sidebar.py from Chemically-motivated/OSINT_Tool: direct link, hf CLI and curl.
- Browser
- Download file 735 Bytes
-
https://huggingface.co/spaces/Chemically-motivated/OSINT_Tool/resolve/51d1e833318492e8e0cd2326e65bb27608426071/tests/test_sidebar.py
- Command line
-
hf download hf://spaces/Chemically-motivated/OSINT_Tool@51d1e833318492e8e0cd2326e65bb27608426071/tests/test_sidebar.py
-
curl -L -o test_sidebar.py https://huggingface.co/spaces/Chemically-motivated/OSINT_Tool/resolve/51d1e833318492e8e0cd2326e65bb27608426071/tests/test_sidebar.py
735 Bytes
| import streamlit as st | |
| import unittest | |
| from unittest.mock import MagicMock | |
| from your_module.components.sidebar import sidebar | |
| class TestSidebar(unittest.TestCase): | |
| def test_sidebar_renders_correctly(self): | |
| # Mocking Streamlit session state and config | |
| session_state_mock = MagicMock() | |
| config_mock = {"sidebar_key": "value"} | |
| # Run the sidebar function | |
| sidebar(session_state_mock, config_mock) | |
| # Check if the sidebar rendered specific components (for example, a slider) | |
| # You can assert that Streamlit functions are called as expected | |
| st.sidebar.slider.assert_called_with("Slider", min_value=0, max_value=10, value=5) | |
| if __name__ == '__main__': | |
| unittest.main() | |