@@ -54,11 +54,34 @@ def test_get_no_head_nodes() -> None:
5454
5555
5656def test_get_main () -> None :
57- """Return the main node from an example."""
58- example_html = '<body><main class="content">Hello <em>world</em></main ></body>'
57+ """Return the body nodes from an example."""
58+ example_html = '<body><py-config src="../x.toml">abc</py-config ></body>'
5959 soup = BeautifulSoup (example_html , "html5lib" )
6060 body = get_body_content (soup )
61- assert body == '<main class="content">Hello <em>world</em></main>'
61+ assert body == '<py-config src="../py_config.local.toml">abc</py-config>'
62+
63+
64+ def test_get_py_config_local () -> None :
65+ """Return the main node and test setting py-config src."""
66+ example_html = '<body><py-config src="../x.toml">abc</py-config></body>'
67+ soup = BeautifulSoup (example_html , "html5lib" )
68+ body = get_body_content (soup )
69+ body_soup = BeautifulSoup (body , "html5lib" )
70+ py_config = body_soup .find ("py-config" )
71+ actual = py_config ["src" ]
72+ assert "../py_config.local.toml" == actual
73+
74+
75+ def test_get_py_config_cdn () -> None :
76+ """Return the main node and test setting py-config src."""
77+ example_html = '<body><py-config src="../x.toml">abc</py-config></body>'
78+ soup = BeautifulSoup (example_html , "html5lib" )
79+ test_path = Path ("/x" )
80+ body = get_body_content (soup , test_path = test_path )
81+ body_soup = BeautifulSoup (body , "html5lib" )
82+ py_config = body_soup .find ("py-config" )
83+ actual = py_config ["src" ]
84+ assert "../py_config.cdn.toml" == actual
6285
6386
6487def test_example_bad_path () -> None :
@@ -136,6 +159,6 @@ def test_is_local_no_path() -> None:
136159
137160def test_is_local_broken_path () -> None :
138161 """Test the local case where a directory will not exist."""
139- test_path = Path ("/xxxxxx " )
162+ test_path = Path ("/xxx " )
140163 actual = is_local (test_path )
141164 assert not actual
0 commit comments