"""Smoke test: Home module is importable without DB or heavy computation.""" import importlib import sys def test_home_importable(): # Streamlit cannot run navigation outside of a server context, # so we only verify the file can be parsed/compiled, not fully executed. import ast import os home_path = os.path.join(os.path.dirname(os.path.dirname(__file__)), "Home.py") with open(home_path) as f: source = f.read() # Verify the file parses as valid Python tree = ast.parse(source) # Verify st.navigation is called (modern Streamlit multi-page API) nav_calls = [ node for node in ast.walk(tree) if isinstance(node, ast.Call) and isinstance(node.func, ast.Attribute) and node.func.attr == "navigation" ] assert nav_calls, "Home.py must call st.navigation()" # Verify at least 2 st.Page() calls exist (one per page) page_calls = [ node for node in ast.walk(tree) if isinstance(node, ast.Call) and isinstance(node.func, ast.Attribute) and node.func.attr == "Page" ] assert len(page_calls) >= 2, "Home.py must define at least 2 st.Page() pages"