Skip to content

Commit 9cbaad8

Browse files
DOC: add a doctest step to CI to allow writing testable code blocs, fix existing docstring code examples errors (#592)
* DOC: add a doctest step to CI to allow writing testable code blocs, fix existing docstring code examples errors
1 parent 423a87b commit 9cbaad8

File tree

6 files changed

+17
-6
lines changed

6 files changed

+17
-6
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ Please describe the tests that you ran to verify your changes. Provide instructi
2424

2525
- [ ] I have read the [contributing guidelines](https://github.com/scikit-learn-contrib/MAPIE/blob/master/CONTRIBUTING.rst)
2626
- [ ] I have updated the [HISTORY.rst](https://github.com/scikit-learn-contrib/MAPIE/blob/master/HISTORY.rst) and [AUTHORS.rst](https://github.com/scikit-learn-contrib/MAPIE/blob/master/AUTHORS.rst) files
27-
- [ ] Linting passes successfully : `make lint`
28-
- [ ] Typing passes successfully : `make type-check`
29-
- [ ] Unit tests pass successfully : `make tests`
30-
- [ ] Coverage is 100% : `make coverage`
31-
- [ ] Documentation builds successfully and without warnings : `make doc`
27+
- [ ] Linting passes successfully: `make lint`
28+
- [ ] Typing passes successfully: `make type-check`
29+
- [ ] Unit tests pass successfully: `make tests`
30+
- [ ] Coverage is 100%: `make coverage`
31+
- [ ] When updating documentation: doc builds successfully and without warnings: `make doc`
32+
- [ ] When updating documentation: code examples in doc run successfully: `make doctest`

.readthedocs.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ build:
44
os: ubuntu-22.04
55
tools:
66
python: "mambaforge-22.9"
7+
jobs:
8+
post_build:
9+
- cd doc && make doctest
710

811
python:
912
install:

HISTORY.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ History
1515
* Limit max sklearn version allowed at MAPIE installation
1616
* Refactor MapieRegressor, EnsembleRegressor, and MapieQuantileRegressor, to prepare for the release of v1.0.0
1717
* Documentation build: fix warnings, fix image generation, update sklearn version requirement
18+
* Documentation test: add a doc testing step (in MAKEFILE and CI)
1819
* Increase max line length from 79 to 88 characters
1920
* Bump wheel version
2021

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ coverage:
2222
doc:
2323
$(MAKE) html -C doc
2424

25+
doctest:
26+
$(MAKE) doctest -C doc
27+
2528
clean-doc:
2629
$(MAKE) clean -C doc
2730

mapie/metrics.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@ def regression_ssc_score(
560560
561561
Examples
562562
--------
563-
>>> from mapie.metrics import regression_ssc
563+
>>> from mapie.metrics import regression_ssc_score
564564
>>> import numpy as np
565565
>>> y_true = np.array([5, 7.5, 9.5])
566566
>>> y_intervals = np.array([
@@ -1283,6 +1283,7 @@ def kolmogorov_smirnov_p_value(y_true: NDArray, y_score: NDArray) -> float:
12831283
Examples
12841284
--------
12851285
>>> import pandas as pd
1286+
>>> import numpy as np
12861287
>>> from mapie.metrics import kolmogorov_smirnov_p_value
12871288
>>> y_true = np.array([1, 0, 1, 0, 1, 0])
12881289
>>> y_score = np.array([0.8, 0.3, 0.5, 0.5, 0.7, 0.1])
@@ -1450,6 +1451,7 @@ def kuiper_p_value(y_true: NDArray, y_score: NDArray) -> float:
14501451
Examples
14511452
--------
14521453
>>> import pandas as pd
1454+
>>> import numpy as np
14531455
>>> from mapie.metrics import kuiper_p_value
14541456
>>> y_true = np.array([1, 0, 1, 0, 1, 0])
14551457
>>> y_score = np.array([0.8, 0.3, 0.5, 0.5, 0.7, 0.1])

mapie/mondrian.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ class MondrianCP(BaseEstimator):
7272
>>> import numpy as np
7373
>>> from sklearn.linear_model import LogisticRegression
7474
>>> from mapie.classification import MapieClassifier
75+
>>> from mapie.mondrian import MondrianCP
7576
>>> X_toy = np.arange(9).reshape(-1, 1)
7677
>>> y_toy = np.stack([0, 0, 1, 0, 1, 2, 1, 2, 2])
7778
>>> partition_toy = [0, 0, 0, 0, 1, 1, 1, 1, 1]

0 commit comments

Comments
 (0)