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 c50d403..8415373 100644 --- a/README.md +++ b/README.md @@ -12,14 +12,19 @@ pip install hexlet-points ## Usage example - - - from hexlet import points - p = points.make(100, 200) - print(points.to_string(p)) # (100, 200) - points.get_x(p) # 100 - points.get_y(p) # 200 - points.get_quadrant(p) # 1 +```python +>>> from hexlet import points +>>> p = points.make(100, 200) +>>> print(points.to_string(p)) +(100, 200) +>>> points.get_x(p) +100 +>>> points.get_y(p) +200 +>>> points.get_quadrant(p) +1 + +``` ---