mirror of
https://github.com/ai-robots-txt/ai.robots.txt.git
synced 2025-04-20 00:45:03 +00:00
simplify repo and added some tests
This commit is contained in:
parent
6bb598820e
commit
0c05461f84
11 changed files with 527 additions and 181 deletions
21
code/tests.py
Normal file
21
code/tests.py
Normal file
|
@ -0,0 +1,21 @@
|
|||
"""These tests can be run with pytest.
|
||||
This requires pytest: pip install pytest
|
||||
cd to the `code` directory and run `pytest`
|
||||
"""
|
||||
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
from dark_visitors import json_to_txt, json_to_table
|
||||
|
||||
|
||||
def test_robots_txt_creation():
|
||||
robots_json = json.loads(Path("test_files/robots.json").read_text())
|
||||
robots_txt = json_to_txt(robots_json)
|
||||
assert Path("test_files/robots.txt").read_text() == robots_txt
|
||||
|
||||
|
||||
def test_table_of_bot_metrices_md():
|
||||
robots_json = json.loads(Path("test_files/robots.json").read_text())
|
||||
robots_table = json_to_table(robots_json)
|
||||
assert Path("test_files/table-of-bot-metrics.md").read_text() == robots_table
|
Loading…
Add table
Add a link
Reference in a new issue