chiliec opened a new pull request, #1475: URL: https://github.com/apache/mahout/pull/1475
### Related Issues Closes #1470 ### Changes - [x] Bug fix - [x] Test ### Why `QuantumDataLoader` validated encoding names case-insensitively (`method.lower() not in _VALID_ENCODINGS`) but stored the original spelling. A mixed-case name such as `"Amplitude"` therefore passed builder validation and only failed later, when iteration forwarded the raw string to a case-sensitive backend: ```text builder accepted encoding ValueError: Unknown encoding method 'Amplitude'. Supported: amplitude, angle, basis, iqp, iqp-z ``` ### How Normalize the accepted encoding name to its canonical lowercase form at the two places it is stored — the constructor and the `.encoding()` setter — mirroring the existing `.dtype()` handling (`name.strip().lower()`). Unknown encodings are still rejected. The `.encoding()` docstring is updated to state that names are matched case-insensitively and normalized before reaching the backend. ### Validation Reproduced the issue against `main`, then verified the fix. Environment: Python 3.11, PyTorch 2.14 (CPU) — the `_qdp` Rust extension is not built, so verification runs through the pure-Python PyTorch backend path. ``` $ python -m pytest qdp/qdp-python/tests/test_loader_encoding_case.py -q 5 passed $ python -m pytest qdp/qdp-python -q 12 passed, 21 skipped # skips are GPU/AMD-only suites, unavailable on this host ``` RED→GREEN: reverting the source change (keeping the new tests) fails 4 of the 5 new tests with the exact `ValueError` above; restoring it makes them pass. `ruff check` and `ruff format --check` are clean on both changed files. ## Checklist - [x] Added or updated unit tests for all changes - [x] Added or updated documentation for all changes -- 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]
