This repository was archived by the owner on Nov 10, 2025. It is now read-only.

Description
Description
Add a job named doctest to the test.yml workflow. The job should run doctest against the examples in the nums package.
Use case
#153 added docstrings to functions. Now that we have examples in our code, we should ensure that examples run correctly because:
- Incorrect examples are frustrating for the user.
- If we test examples, we'll be more confident about the correctness of NumS.
For example, the examples in #436 should be tested.
Examples
--------
Convert a list into an array:
>>> a = [1, 2]
>>> nps.asarray(a).get()
array([1, 2])
Existing arrays are not copied:
>>> a = nps.array([1, 2])
>>> nps.asarray(a) is a
True
If `dtype` is set, array is copied only if dtype does not match:
>>> a = nps.array([1, 2], dtype=np.float32)
>>> nps.asarray(a, dtype=np.float32) is a
True
>>> nps.asarray(a, dtype=np.float64) is a
False
Open Questions
- Which Python versions should we run doctests against?
- Which backends should we run doctests against?
- Should doctests be part of a new job, or should we add them to the existing
pytest job? (In this case, we'd want to rename the pytest job)