Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

addressing doctests failure (numpy-2.0) #219

Merged
merged 5 commits into from
Jun 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,20 @@ jobs:
run: 'python -c "import geopandas; geopandas.show_versions();"'
if: contains(matrix.environment-file, 'DEV')

- name: run tests
run: pytest giddy --cov giddy -v -n auto -r a --doctest-modules --color yes --cov-report term-missing --cov-report xml

- name: run pytest
run: pytest giddy -r a -v -n auto --cov giddy --cov-report xml --color yes --cov-append --cov-report term-missing

- name: run docstring tests
if: contains(matrix.environment-file, '311-DEV') && contains(matrix.os, 'ubuntu')
run: |
pytest \
-v \
-r a \
-n auto \
--color yes \
--cov giddy --cov-report xml --cov-append \
--doctest-only --doctest-continue-on-failure giddy

- name: codecov
uses: codecov/codecov-action@v3
with:
Expand Down
11 changes: 11 additions & 0 deletions ci/311-DEV.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ dependencies:
- pip
- quantecon>=0.4.7
- scipy>=1.3.0
- esda>=2.1.1
- libpysal>=4.0.1
- mapclassify>=2.1.1
- splot
# testing
- codecov
- ipywidgets
Expand All @@ -16,3 +20,10 @@ dependencies:
- pytest
- pytest-cov
- pytest-xdist
- pytest-doctestplus
# docs (this env only)
- nbsphinx
- numpydoc
- sphinx>=1.4.3
- sphinxcontrib-bibtex
- sphinx_bootstrap_theme
6 changes: 0 additions & 6 deletions ci/311.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,3 @@ dependencies:
- pytest
- pytest-cov
- pytest-xdist
# docs (this env only)
- nbsphinx
- numpydoc
- sphinx>=1.4.3
- sphinxcontrib-bibtex
- sphinx_bootstrap_theme
16 changes: 8 additions & 8 deletions giddy/markov.py
Original file line number Diff line number Diff line change
Expand Up @@ -1119,7 +1119,7 @@ def chi2(T1, T2):
[ 1., 92., 815., 51.],
[ 1., 0., 60., 903.]])
>>> chi2(T1,T2)
(23.39728441473295, 0.005363116704861337, 9)
(np.float64(23.39728441473295), np.float64(0.005363116704861337), np.int64(9))

Notes
-----
Expand Down Expand Up @@ -1468,20 +1468,20 @@ def spillover(self, quadrant=1, neighbors_on=False):
>>> lm_random = LISA_Markov(pci, w, permutations=99)
>>> r = lm_random.spillover()
>>> (r['components'][:, 12] > 0).sum()
17
np.int64(17)
>>> (r['components'][:, 13]>0).sum()
23
np.int64(23)
>>> (r['spill_over'][:,12]>0).sum()
6
np.int64(6)

Including neighbors of core neighbors
>>> rn = lm_random.spillover(neighbors_on=True)
>>> (rn['components'][:, 12] > 0).sum()
26
np.int64(26)
>>> (rn["components"][:, 13] > 0).sum()
34
np.int64(34)
>>> (rn["spill_over"][:, 12] > 0).sum()
8
np.int64(8)

"""
n, k = self.q.shape
Expand Down Expand Up @@ -2081,7 +2081,7 @@ def sojourn_time(p, summary=True):

>>> p = np.array([[.5, .25, .25], [.5, 0, .5],[ 0, 0, 0]])
>>> sojourn_time(p)
Sojourn times are infinite for absorbing states! In this Markov Chain, states [2] are absorbing states.
Sojourn times are infinite for absorbing states! In this Markov Chain, states [np.int64(2)] are absorbing states.
array([ 2., 1., inf])
""" # noqa E501

Expand Down
8 changes: 4 additions & 4 deletions giddy/rank.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,10 +469,10 @@ class Tau_Local:
0.48387097, 0.93548387, 0.61290323, 0.74193548, 0.41935484,
0.61290323, 0.61290323])
>>> tau_local.tau
0.6612903225806451
np.float64(0.6612903225806451)
>>> tau_classic = Tau(r[:,0],r[:,1])
>>> tau_classic.tau
0.6612903225806451
np.float64(0.6612903225806451)

"""

Expand Down Expand Up @@ -586,10 +586,10 @@ class Tau_Local_Neighbor:
array([-1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, -1, -1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1])
>>> (res.tau_ln * res.tau_ln_weights).sum() #global spatial tau
0.39682539682539675
np.float64(0.39682539682539675)
>>> res1 = SpatialTau(r[:,0],r[:,1],w,permutations=999)
>>> res1.tau_spatial
0.3968253968253968
np.float64(0.3968253968253968)

"""

Expand Down
Loading