Structural v/s symbolic equality for SymPy tests

Abierto
#602 1 comentario 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
25/100
Tipo de issue
Refactorización
Claridad
Necesita aclaración
Estado de actividad
Estancado
Stack tecnológico
python
Área
testing

Línea de trabajo

Empieza leyendo tests/test_compute_features.py y la discusión enlazada en #581 para entender dónde se utiliza la igualdad estructural y por qué se propuso la igualdad simbólica. El trabajo estará completo cuando el proyecto tenga una estrategia de igualdad acordada, las pruebas pertinentes la sigan de forma coherente y la suite de pruebas pase en todas las versiones de Python compatibles.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

tests

#581 raises the question of structural (x == y) v/s symbolic (simplify(x - y) == 0 or Eq(x, y)) equality. Even though symbolic equality would be easier to maintain in the longer run, it would be better to use the structural equality wherever possible to be more strict as -

Originally posted by @Saransh-cpp in https://github.com/scikit-hep/vector/pull/581#pullrequestreview-2806944886

Tests failing without being mathematically wrong is bad IMO, since they will sooner or later fail with sympy updates (as is the case now from 1.13.1 -> 1.14.0). Hence I prefer symbolic comparison.

In fact it is quite similar to checking floating points by an epsilon range, since the backend computation can change, but the result is still right (wrt. the scope).

Originally posted by @APN-Pucky in https://github.com/scikit-hep/vector/issues/581#issuecomment-2863341676

Thanks! My comment behind using structural equality was because the "symbolic" nature of our compute functions will solely be tested by SymPy once Python 3.8 is removed from GH Actions; hence, we would want these tests to be strict (unless we find another way - #531). But at the same time, I don't think this strictness is actually adding anything to the test suite - the symbolic equality will test the exact same thing but in a more flexible way.

Given that we use structural equality everywhere in the tests, I have reverted to keep using that for now. However, I will open an issue to discuss this further (and possibly change all equalities in the tests in the future).

Originally posted by @Saransh-cpp in https://github.com/scikit-hep/vector/issues/581#issuecomment-2927882803

Lenguaje dominante
Python
Estrellas
102
Forks
45
Merge medio
5 h 1 min
PR fusionados (30 d)
2

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de scikit-hep/vector

Todos los issues de scikit-hep/vector

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.