Skip to content

Conversation

@viiccwen
Copy link
Contributor

Purpose of PR

  • Added comprehensive 2D array batch encoding test coverage
  • Simplified test structure using helper functions and parameterized tests
  • Removed redundant code and followed pytest best practices

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)

Related Issues or PRs

closes #823

Changes Made

  • Bug fix
  • New feature
  • Refactoring
  • Documentation
  • Test
  • CI/CD pipeline
  • Other

Breaking Changes

  • Yes
  • No

Checklist

  • Added or updated unit tests for all changes
  • Added or updated documentation for all changes
  • Successfully built and ran all unit tests or manual tests locally
  • PR title follows "MAHOUT-XXX: Brief Description" format (if related to an issue)
  • Code follows ASF guidelines

Additional

  • Add support for angle and basis encoding methods (currently only amplitude is implemented)

…verage

- Updated test descriptions to better reflect functionality.
- Consolidated encoding tests into parameterized cases for basic, large, and single sample inputs.
- Introduced helper function to verify tensor properties, enhancing code reuse.
- Added tests for different encoding methods and precision settings.
- Implemented error handling tests for invalid inputs and unsupported dimensions.
@viiccwen
Copy link
Contributor Author

cc @ryankert01 , @guan404ming , @400Ping , thx!

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors and extends NumPy encoding tests to improve clarity, maintainability, and test coverage. The changes consolidate redundant test code into reusable helper functions and add new test cases for 2D array batch encoding, precision settings, and error handling.

Changes:

  • Refactored three similar test functions into a single parameterized test with a helper function
  • Added comprehensive test coverage for NumPy array encoding (both 1D and 2D)
  • Added tests for encoding configurations (precision settings and encoding methods)
  • Added error handling tests for invalid inputs

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Member

@ryankert01 ryankert01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution! LG!

@ryankert01 ryankert01 merged commit a74d5a2 into apache:main Jan 15, 2026
4 checks passed
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.

[QDP] [Test] Add and refactor NumPy encoding tests

2 participants