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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to