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

tests: Improve _bool_array_to_int in DI reader test #571

Merged
merged 1 commit into from
Apr 25, 2024

Conversation

bkeryan
Copy link
Collaborator

@bkeryan bkeryan commented Apr 24, 2024

What does this Pull Request accomplish?

  • Use NumPy slicing instead of reversed(...) to reverse the bool array.
  • Use int(bit) to explicitly convert the NumPy array element to a Python int, which prevents setting the sign bit with large ports and returning negative numbers.
  • In one test case, slice a 2D bool array into a 1D bool array view in order to avoid DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)

Why should this Pull Request be merged?

Fix issues I discovered when writing another test.

What testing has been done?

poetry run pytest -v .\tests\component\test_stream_readers_di.py passes with LibraryInterpreter. (I don't currently have NI gRPC Device Server installed.)

Copy link

Test Results

    34 files  ±0      34 suites  ±0   47m 42s ⏱️ + 2m 0s
 2 248 tests ±0   1 910 ✅ ±0    338 💤 ±0  0 ❌ ±0 
39 690 runs  ±0  34 134 ✅ ±0  5 556 💤 ±0  0 ❌ ±0 

Results for commit 07671a8. ± Comparison against base commit 5e0380b.

@bkeryan bkeryan merged commit af9e449 into master Apr 25, 2024
17 checks passed
@bkeryan bkeryan deleted the users/bkeryan/test-stream-readers-di branch April 25, 2024 13:07
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.

2 participants