Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Missing use cases for binops on array vs. scalar

Aperta
#364 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
38/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
python
Ambito
testing-qa

Direzione di ricerca

Inizia con le sezioni referenziate di array_api_tests/hypothesis_helpers.py, quindi esamina test_binary_with_scalars_real in test_operators_and_elementwise_functions.py e test_binary in test_special_cases.py. Confronta i loro input generati con i casi elencati di scalari interi, valori speciali e valori fuori intervallo; il lavoro è completo quando i casi mancanti sono coperti e il comportamento dell'intervallo di float/complex è chiarito.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

After reading hh.scalars, I understand that array-api-tests currently never generates the use cases of a binop where one argument is an Array with float or complex dtype and the other argument is

  • a pure-python integer;
  • a scalar inf, -inf, or nan;
  • a scalar outside of the range [1/64, 64]

Unless I missed something and the tests for these cases are somewhere else?

https://github.com/data-apis/array-api-tests/blob/c1e5cda7836963e58e40bcdf68881a569b8c64d5/array_api_tests/hypothesis_helpers.py#L451-L481

https://github.com/data-apis/array-api-tests/blob/c1e5cda7836963e58e40bcdf68881a569b8c64d5/array_api_tests/hypothesis_helpers.py#L590-L597

Note that the [1/64, 64] range exclusively applies to float/complex. The code could use a clarification there as it is not obvious upon first read that integers ignore it.

e.g. pytest -k minimum returns this:

array_api_tests/test_has_names.py::test_has_names[elementwise-minimum] PASSED                                                                                    [ 20%]
array_api_tests/test_operators_and_elementwise_functions.py::test_minimum PASSED                                                                                 [ 40%]
array_api_tests/test_operators_and_elementwise_functions.py::test_binary_with_scalars_real[minimum] SKIPPED (requires ARRAY_API_TESTS_VERSION >= 2024.12)        [ 60%]
array_api_tests/test_signatures.py::test_func_signature[minimum] PASSED                                                                                          [ 80%]
array_api_tests/test_special_cases.py::test_binary[minimum(x1_i is NaN or x2_i is NaN) -> NaN] PASSED   

To my understanding

  • in test_binary_with_scalars_real, when one arg is Array[float64] or Array[float32], the other arg is always in the [1/64, 64] range;
  • test_special_cases::test_binary only tests arrays containing NaN, not scalar NaN;
  • none tests inf or arrays containing inf

related:

Lingua principale
Python
Stelle
74
Fork
54
Merge medio
4h 35m
PR unite (30g)
4

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di data-apis/array-api-tests

Tutte le issue di data-apis/array-api-tests

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.