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

Fix syntax error in test related to cupy #9000

Merged
merged 1 commit into from
May 5, 2024

Conversation

hmaarrfk
Copy link
Contributor

@hmaarrfk hmaarrfk commented May 5, 2024

I suspect the CIs don't have cupy which meant that this line didn't get hit.

Recreation:

mamba create --name xr_py10 python=3.10 --channel conda-forge --override-channels
mamba activate xr_py10
pip install -e . -vv
pip install pytest
mamba install cupy
pytest xarray/tests/test_array_api.py -x

Fails on my machine.

Happy to provide more info.

See: https://github.com/pydata/xarray/pull/8723/files#r1590298540

  • Closes #xxxx
  • Tests added
  • User visible changes (including notable bug fixes) are documented in whats-new.rst
  • New functions/methods are listed in api.rst

I suspect the CIs don't have cupy which meant that this line didn't get
hit.

Recreation:

```
mamba create --name xr_py10 python=3.10 --channel conda-forge --override-channels
mamba activate xr_py10
pip install -e . -vv
pip install pytest
mamba install cupy
```

```
pytest xarray/tests/test_array_api.py -x
```

Fails on my machine.

Happy to provide more info
@max-sixty
Copy link
Collaborator

Nice, thanks!

(good reminder that type checking is useful!)

@max-sixty max-sixty merged commit c2b9429 into pydata:main May 5, 2024
28 checks passed
@keewis
Copy link
Collaborator

keewis commented May 5, 2024

this is actually valid syntax... except := has a very low priority, which means that we're trying to assign array_type("cupy") and any(...) to array_type_cupy, which does not work because we're making use of it in the generator expression. It would work, however, if we wrapped the := in parentheses:

    elif (array_type_cupy := array_type("cupy")) and any(  # noqa: F841
        isinstance(x, array_type_cupy) for x in scalars_or_arrays  # noqa: F821
    ):

@hmaarrfk
Copy link
Contributor Author

hmaarrfk commented May 5, 2024

hmm i see, yeah, I've never used the walrus operator in practice. only read about it.

hmaarrfk added a commit to hmaarrfk/xarray that referenced this pull request May 6, 2024
I suspect the CIs don't have cupy which meant that this line didn't get
hit.

Recreation:

```
mamba create --name xr_py10 python=3.10 --channel conda-forge --override-channels
mamba activate xr_py10
pip install -e . -vv
pip install pytest
mamba install cupy
```

```
pytest xarray/tests/test_array_api.py -x
```

Fails on my machine.

Happy to provide more info
andersy005 pushed a commit that referenced this pull request May 10, 2024
I suspect the CIs don't have cupy which meant that this line didn't get
hit.

Recreation:

```
mamba create --name xr_py10 python=3.10 --channel conda-forge --override-channels
mamba activate xr_py10
pip install -e . -vv
pip install pytest
mamba install cupy
```

```
pytest xarray/tests/test_array_api.py -x
```

Fails on my machine.

Happy to provide more info
andersy005 added a commit that referenced this pull request May 10, 2024
* main:
  Avoid auto creation of indexes in concat (#8872)
  Fix benchmark CI (#9013)
  Avoid extra read from disk when creating Pandas Index. (#8893)
  Add a benchmark to monitor performance for large dataset indexing (#9012)
  Zarr: Optimize `region="auto"` detection (#8997)
  Trigger CI only if code files are modified. (#9006)
  Fix for ruff 0.4.3 (#9007)
  Port negative frequency fix for `pandas.date_range` to `cftime_range` (#8999)
  Bump codecov/codecov-action from 4.3.0 to 4.3.1 in the actions group (#9004)
  Speed up localize (#8536)
  Simplify fast path (#9001)
  Add argument check_dims to assert_allclose to allow transposed inputs (#5733) (#8991)
  Fix syntax error in test related to cupy (#9000)
andersy005 added a commit to hmaarrfk/xarray that referenced this pull request May 10, 2024
* backend-indexing:
  Trigger CI only if code files are modified. (pydata#9006)
  Enable explicit use of key tuples (instead of *Indexer objects) in indexing adapters and explicitly indexed arrays (pydata#8870)
  add `.oindex` and `.vindex` to `BackendArray` (pydata#8885)
  temporary enable CI triggers on feature branch
  Avoid auto creation of indexes in concat (pydata#8872)
  Fix benchmark CI (pydata#9013)
  Avoid extra read from disk when creating Pandas Index. (pydata#8893)
  Add a benchmark to monitor performance for large dataset indexing (pydata#9012)
  Zarr: Optimize `region="auto"` detection (pydata#8997)
  Trigger CI only if code files are modified. (pydata#9006)
  Fix for ruff 0.4.3 (pydata#9007)
  Port negative frequency fix for `pandas.date_range` to `cftime_range` (pydata#8999)
  Bump codecov/codecov-action from 4.3.0 to 4.3.1 in the actions group (pydata#9004)
  Speed up localize (pydata#8536)
  Simplify fast path (pydata#9001)
  Add argument check_dims to assert_allclose to allow transposed inputs (pydata#5733) (pydata#8991)
  Fix syntax error in test related to cupy (pydata#9000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants