You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mahout.apache.org by "viiccwen (via GitHub)" <gi...@apache.org> on 2026/01/15 05:55:54 UTC
[I] # [QDP] [Test] Add and refactor NumPy encoding tests [mahout]
viiccwen opened a new issue, #823:
URL: https://github.com/apache/mahout/issues/823
### Summary
Add and refactor NumPy encoding tests in `test_numpy.py` to improve maintainability and add 2D array batch encoding test coverage.
### Use Case
The NumPy encoding tests were lacked coverage for 2D array batch encoding scenarios. This refactoring:
1. **Adds 2D array testing** - Ensures batch encoding works correctly for 2D NumPy arrays
2. **Follows pytest best practices** - Removes unnecessary `if __name__ == "__main__":` blocks
3. **Improves maintainability** - Uses helper functions and parameterized tests for cleaner code
### Proposed Implementation
1. **Added 2D array batch encoding tests**
- Extended `test_encode_numpy_array()` to test both 1D (single sample) and 2D (batch) arrays
- Tests various batch sizes and qubit configurations
2. **Code cleanup**
- Removed redundant `if __name__ == "__main__":` block (pytest handles test discovery automatically)
- Removed unnecessary print statements
- Fixed tests to only test implemented encoding methods (amplitude, not angle/basis)
3. **Test coverage**
- NumPy file format encoding (`.npy` files)
- 1D NumPy array encoding (single sample)
- 2D NumPy array encoding (batch)
- Different precision settings (float32, float64)
- Error handling (wrong dtype, unsupported dimensions)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@mahout.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [QDP] [Test] Add and refactor NumPy encoding tests [mahout]
Posted by "ryankert01 (via GitHub)" <gi...@apache.org>.
ryankert01 closed issue #823: [QDP] [Test] Add and refactor NumPy encoding tests
URL: https://github.com/apache/mahout/issues/823
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@mahout.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] # [QDP] [Test] Add and refactor NumPy encoding tests [mahout]
Posted by "viiccwen (via GitHub)" <gi...@apache.org>.
viiccwen commented on issue #823:
URL: https://github.com/apache/mahout/issues/823#issuecomment-3753018998
Take
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@mahout.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org