55import pytest
66from bs4 import BeautifulSoup
77
8- from psc .resources import Example
8+ from psc .resources import Example , get_sorted_examples
99from psc .resources import Page
1010from psc .resources import get_body_content
1111from psc .resources import get_head_nodes
1212from psc .resources import get_resources
1313from psc .resources import is_local
1414from psc .resources import tag_filter
1515
16-
1716IS_LOCAL = is_local ()
1817
1918
@@ -117,8 +116,8 @@ def test_example() -> None:
117116 this_example = Example (path = PurePath ("hello_world" ))
118117 assert this_example .title == "Hello World"
119118 assert (
120- this_example .subtitle
121- == "The classic hello world, but in Python -- in a browser!"
119+ this_example .subtitle
120+ == "The classic hello world, but in Python -- in a browser!"
122121 )
123122 assert "hello_world.css" in this_example .extra_head
124123 assert "<h1>Hello ...</h1>" in this_example .body
@@ -153,6 +152,12 @@ def test_missing_page() -> None:
153152 assert str (exc .value ) == "No page at xxx"
154153
155154
155+ def test_sorted_examples () -> None :
156+ examples = get_sorted_examples ()
157+ first_example = examples [0 ]
158+ assert "altair" == first_example .name
159+
160+
156161def test_get_resources () -> None :
157162 """Ensure the dict-of-dicts is generated with PurePath keys."""
158163 resources = get_resources ()
@@ -162,8 +167,8 @@ def test_get_resources() -> None:
162167 hello_world = resources .examples [hello_world_path ]
163168 assert hello_world .title == "Hello World"
164169 assert (
165- hello_world .subtitle
166- == "The classic hello world, but in Python -- in a browser!"
170+ hello_world .subtitle
171+ == "The classic hello world, but in Python -- in a browser!"
167172 )
168173
169174 # Page
0 commit comments