forked from ChelseaKR/tods-validate
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_playground.py
More file actions
27 lines (19 loc) · 992 Bytes
/
Copy pathtest_playground.py
File metadata and controls
27 lines (19 loc) · 992 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
"""The browser playground stays wired to the public API it calls.
The playground runs hardcoded Python in Pyodide, so the only thing that can
silently break it from this side is renaming the API it imports. These guards
fail loudly if that happens. (The page itself needs a browser to test end to
end; see web/README.md.)
"""
from pathlib import Path
_HTML = Path(__file__).resolve().parent.parent / "web" / "index.html"
def test_playground_references_the_public_api() -> None:
html = _HTML.read_text()
assert "from tods_validate.api import validate_feed" in html
assert "from tods_validate.report import render_html" in html
assert "micropip.install" in html # installs the published wheel in-browser
def test_playground_api_symbols_exist() -> None:
from tods_validate.api import validate_feed
from tods_validate.report import render_html
# The playground calls these exact signatures.
assert callable(validate_feed)
assert callable(render_html)