Enable testing doctest in the package docstrings (#2111)
* Exclude examples directory from test coverage in CI workflow * demo * case
This commit is contained in:
parent
44614dea94
commit
93d419d7c6
|
|
@ -44,7 +44,7 @@ jobs:
|
|||
run: uv run python -c "import supervision; from supervision import assets; from supervision import metrics; print(supervision.__version__)"
|
||||
|
||||
- name: 🧪 Run the Test
|
||||
run: uv run pytest --cov=supervision --cov-report=xml
|
||||
run: uv run pytest --cov=supervision --cov-report=xml --ignore=examples
|
||||
|
||||
- name: Generate Coverage Report
|
||||
run: |
|
||||
|
|
|
|||
|
|
@ -187,6 +187,13 @@ count = true
|
|||
quiet-level = 3
|
||||
ignore-words-list = "STrack,sTrack,strack"
|
||||
|
||||
[tool.pytest.ini_options]
|
||||
addopts = [
|
||||
"--doctest-modules",
|
||||
"--color=yes",
|
||||
]
|
||||
doctest_optionflags = "ELLIPSIS NORMALIZE_WHITESPACE"
|
||||
|
||||
[tool.mypy]
|
||||
python_version = "3.9"
|
||||
ignore_missing_imports = false
|
||||
|
|
|
|||
|
|
@ -4,6 +4,10 @@ import numpy as np
|
|||
|
||||
|
||||
def validate_xyxy(xyxy: Any) -> None:
|
||||
"""Validate that xyxy is a 2D np.ndarray with shape (N, 4).
|
||||
|
||||
>>> validate_xyxy(np.array([[0, 0, 1, 1], [1, 1, 2, 2]]))
|
||||
"""
|
||||
expected_shape = "(_, 4)"
|
||||
actual_shape = str(getattr(xyxy, "shape", None))
|
||||
is_valid = isinstance(xyxy, np.ndarray) and xyxy.ndim == 2 and xyxy.shape[1] == 4
|
||||
|
|
|
|||
Loading…
Reference in New Issue