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

try testing numpy <2 and >=2 #409

Closed
wants to merge 10 commits into from
Closed
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
19 changes: 17 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,24 @@ on:

jobs:
tests:
name: Py${{ matrix.python-version }} ${{ matrix.os }}
name: Py${{ matrix.python-version }} ${{ matrix.os }} NumPy${{ matrix.numpy-version }}
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [macos-latest, windows-latest, ubuntu-22.04]
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
python-version: ['3.9', '3.10', '3.11', '3.12']
numpy-version: ['<2', '>=2']
include:
- os: macos-latest
python-version: '3.8'
numpy-version: '<2'
- os: windows-latest
python-version: '3.8'
numpy-version: '<2'
- os: ubuntu-22.04
python-version: '3.8'
numpy-version: '<2'

steps:
- uses: actions/[email protected]
Expand All @@ -41,6 +52,10 @@ jobs:
pip install --upgrade pip setuptools wheel
pip install .[test]

- name: Install NumPy
run: |
pip install --force-reinstall "numpy${{ matrix.numpy-version }}"

- name: Tests
run: |
pip install cython
Expand Down
21 changes: 20 additions & 1 deletion tests/test_apis/test_numpy_int.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@


def test1():
lat, lng = 37.7752702151959, -122.418307270836,
lat, lng = (
37.7752702151959,
-122.418307270836,
)
assert h3.latlng_to_cell(lat, lng, 9) == 617700169958293503


Expand All @@ -31,3 +34,19 @@ def test_compact_cells():
assert isinstance(cells, np.ndarray)

assert h3.compact_cells(cells) == [h]


def test_numpy_str():
expected = [
617700169957507071,
617700169957769215,
617700169958031359,
617700169958293503,
617700169961177087,
617700169964847103,
617700169965109247,
]
cells = np.array([h3.int_to_str(h) for h in expected])
got = [h3.str_to_int(c) for c in cells]

assert expected == got
Loading