diff --git a/.github/workflows/pyci.yml b/.github/workflows/pyci.yml index 7956d81..827bed5 100644 --- a/.github/workflows/pyci.yml +++ b/.github/workflows/pyci.yml @@ -25,3 +25,5 @@ jobs: run: make lint - name: Run tests run: make test + - name: Run doctests + run: make doctest diff --git a/Makefile b/Makefile index 29f7119..527e7a7 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,10 @@ lint: test: @uv run pytest test -check: install lint test +doctest: + @uv run pytest --doctest-glob='*.md' README.md + +check: install lint test doctest build: @uv build @@ -17,4 +20,4 @@ build: publish: build @uv publish --trusted-publishing always -.PHONY: install lint test check build publish +.PHONY: install lint test doctest check build publish diff --git a/README.md b/README.md index c4874a2..c8555c5 100644 --- a/README.md +++ b/README.md @@ -12,14 +12,19 @@ pip install hexlet-pairs ## Usage - - - from hexlet import pairs - p = pairs.cons(42, 'foo') - pairs.is_pair(p) # True - pairs.car(p) # 42 - pairs.cdr(p) # 'foo' - print(pairs.to_string(p)) # cons(42, 'foo') +```python +>>> from hexlet import pairs +>>> p = pairs.cons(42, 'foo') +>>> pairs.is_pair(p) +True +>>> pairs.car(p) +42 +>>> pairs.cdr(p) +'foo' +>>> print(pairs.to_string(p)) +cons(42, 'foo') + +``` ---