ansys / ansys/pyansys-tools-variableinterop

RealArrayValue equality operator incorrect

Open Beginner friendly
#207 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
3
Forks
0
PR merge metrics
No merged PRs in 30d

Description

### 🔍 Before submitting the issue

- [x] I have searched among the existing issues
- [x] I am using a Python virtual environment

### 🐞 Description of the bug

The equality operator on RealArrayValue fails for any non-trivial value comparisons, such as these values:
```
RealArrayValue([22. , 21.25249433, 20.68407247, 20.23891254,
19.87878449, 19.57750685, 19.31714821, 19.08542529,
18.87392132, 18.67686612, 18.49030116])
```
It is currently implemented using np.array_equal, and should instead use np.allclose.

### 📝 Steps to reproduce

Create two identical RealArrayValues and try to check if they are equal.
The unit tests should be updated to use values with enough significant digits to reproduce the issue.

### 💻 Which operating system are you using?

Windows

### 📀 Which ANSYS version are you using?

_No response_

### 🐍 Which Python version are you using?

3.13

### 📦 Installed packages

```shell
ansys-cam-thrift==0.0.1.dev1
ansys-common-plugins==0.1.0
ansys-pacz-fileapi @ file:///C:/ansysdev/Git/py-pacz/dist/ansys_pacz_fileapi-0.2.dev3-py3-none-any.whl#sha256=f3a6c5a4900c19071238c9b5dd7ada7c960ceaed72edd594b03d4fc3f9206471
ansys-sphinx-theme==1.7.2
anyio==3.7.1
async-generator==1.10
attrs==23.2.0
Babel==2.15.0
beautifulsoup4==4.12.3
certifi==2024.7.4
cffi==1.17.1
cfgv==3.4.0
charset-normalizer==3.3.2
colorama==0.4.6
coverage==7.6.0
distlib==0.3.8
docutils==0.21.2
filelock==3.15.4
identify==2.6.0
idna==3.7
imagesize==1.4.1
importlib_metadata==8.0.0
iniconfig==2.0.0
Jinja2==3.1.4
librt==0.8.1
MarkupSafe==2.1.5
multipledispatch==0.6.0
mypy==1.20.0
mypy-extensions==1.0.0
nodeenv==1.9.1
numpy==2.2.6
numpydoc==1.5.0
outcome==1.3.0.post0
overrides==7.7.0
packaging==24.1
pathspec==1.0.4
pdf2image==1.17.0
pillow==12.2.0
platformdirs==4.2.2
pluggy==1.5.0
pre_commit==4.5.1
py-cam-common==0.1.0
pyansys-tools-variableinterop==0.1.4
pycountry==19.8.18
pycparser==2.22
pydata-sphinx-theme==0.16.1
Pygments==2.18.0
pytest==7.4.4
pytest-asyncio==0.18.3
pytest-cov==3.0.0
pywin32==311
PyYAML==6.0.1
requests==2.32.3
six==1.16.0
sniffio==1.3.1
snowballstemmer==2.2.0
sortedcontainers==2.4.0
soupsieve==2.5
Sphinx==8.1.3
sphinx-copybutton==0.5.2
sphinxcontrib-applehelp==1.0.8
sphinxcontrib-devhelp==1.0.6
sphinxcontrib-htmlhelp==2.0.6
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.8
sphinxcontrib-serializinghtml==1.1.10
thrift==0.22.0
trio==0.20.0
trio-typing==0.10.0
types-pywin32==311.0.0.20260323
typing_extensions==4.12.2
urllib3==2.2.2
virtualenv==20.26.3
zipp==3.19.2
```

Contributor guide

Open the contributing guide

Research direction

Locate the RealArrayValue equality operator and inspect its current np.array_equal comparison. Review the existing unit tests, add a case using the provided non-trivial values with enough significant digits, and verify that identical RealArrayValues compare equal using the intended floating-point tolerance.

Written by the indexing model from the issue text.

Assessment

Tech stack
numpy, python
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.