Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions tests/test_readme.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import re
from pathlib import Path

import pytest


def _parse_readme_examples():
lines = open(Path(__file__).parent.parent / "README.md").read().splitlines()

# use regex to find all python code blocks
code_blocks = re.findall(r"```python(.*?)```", "\n".join(lines), re.DOTALL)
Comment thread
leifdenby marked this conversation as resolved.

return code_blocks


@pytest.mark.parametrize("example", _parse_readme_examples())
def test_readme_example(example):
exec(example)
Comment thread
khintz marked this conversation as resolved.
Outdated