ansys / ansys/pyansys-tools-variableinterop
Get rid of equality override on array types
- Dominant language
- Python
- Stars
- 3
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
### Summary
`ndarray` equality returns an array of boolean values, checking equality element-wise, by default. This should be preserved in our array variable value types, leaving it up to the client to use that as they need.
**Example**
```python
import numpy as np
x = acvi.IntegerArrayValue(values=[1, 2])
y = acvi.IntegerArrayValue(values=[1, 2])
z = acvi.IntegerArrayValue(values=[1, 3])
# default equality behavior
x_eq_y = (x == y) # [True, True]: acvi.IntegerArrayValue
x_eq_z = (x == z) # [True, False]: acvi.IntegerArrayValue
# client could then do this to check arrays are overall equal
all_x_eq_y = np.all(x == y) # True: np.bool_
all_x_eq_z = np.all(x == z) # False: np.bool_
```
### Tasks
- [ ] Remove `__eq__()` methods from (Real, Integer, Boolean, String)ArrayValue
- [ ] Fix unit tests accordingly
Contributor guide
Research direction
Locate the RealArrayValue, IntegerArrayValue, BooleanArrayValue, and StringArrayValue definitions and their __eq__() methods, then inspect the unit tests covering array equality. Run those tests before and after removing the overrides, and update expectations so equality returns element-wise array values while the full test suite passes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- numpy, python
- Domain
- backend, testing-qa
- Issue type
- Refactor
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100