mirror of
https://github.com/veekun/pokedex.git
synced 2024-08-20 18:16:34 +00:00
Add a test for main-tables.rst
This commit is contained in:
parent
bfd414a4cd
commit
b69a338138
1 changed files with 22 additions and 0 deletions
22
pokedex/tests/test_docs.py
Normal file
22
pokedex/tests/test_docs.py
Normal file
|
@ -0,0 +1,22 @@
|
|||
import os
|
||||
import re
|
||||
|
||||
from pokedex.db.tables import mapped_classes
|
||||
|
||||
def test_main_tables():
|
||||
"""Check that tables.py and main-tables.rst are in sync: every table should
|
||||
be documented, and every documented table should exist."""
|
||||
|
||||
main_tables_path = os.path.join(os.path.dirname(__file__), '../../doc/main-tables.rst')
|
||||
|
||||
with open(main_tables_path) as f:
|
||||
doc_class_names = set(
|
||||
re.findall(r'^\.\. dex-table:: (\w+)$', f.read(), re.MULTILINE)
|
||||
)
|
||||
|
||||
mapped_class_names = set(cls.__name__ for cls in mapped_classes)
|
||||
|
||||
# EXTRA ITEMS IN THE LEFT SET: tables defined but not documented
|
||||
# EXTRA ITEMS IN THE RIGHT SET: tables documented but not defined
|
||||
assert mapped_class_names == doc_class_names
|
||||
|
Loading…
Reference in a new issue