vito-lin-dev opened a new pull request, #59352:
URL: https://github.com/apache/spark/pull/59352

   ### What changes were proposed in this pull request?
   
   This PR adds tests to `python/pyspark/errors/tests/test_errors.py` for code 
paths in `ErrorClassesReader` (`python/pyspark/errors/utils.py`) that were not 
covered:
   
   - `get_message_template`: raising `ValueError` when the main class exists 
but the sub-class does not
   - `get_breaking_change_info`:
     - returning `None` for a `None` error class
     - raising `ValueError` for an unknown main class or sub-class
     - falling back to the main class's `breaking_change_info` when the 
sub-class has none
     - returning `None` when neither the main class nor the sub-class declares 
it
   - `get_sqlstate`: returning `None` for a `None` error class
   
   ### Why are the changes needed?
   
   To improve test coverage of `pyspark.errors.utils.ErrorClassesReader`. These 
error-handling and fallback branches had no tests, so regressions in them would 
not be caught.
   
   ### Does this PR introduce _any_ user-facing change?
   
   No. Test-only change.
   
   ### How was this patch tested?
   
   Added unit tests in `python/pyspark/errors/tests/test_errors.py`.
   
   Ran the test module with coverage before and after the change:
   
   ```
   python/run-tests-with-coverage --python-executables=python3 --testnames 
pyspark.errors.tests.test_errors
   ```
   
   Coverage of `pyspark/errors/utils.py`:
   
   | | Stmts | Miss | BrPart | Cover |
   |---|---|---|---|---|
   | Before | 152 | 72 | 7 | 49% |
   | After | 152 | 66 | 0 | 55% |
   
   All tests pass. `dev/reformat-python` and `dev/lint-python` pass for the 
changed file.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Fable 5.1 (Anthropic), used as a pair-programming 
assistant. The author reviewed every line, ran the tests, and verified the 
coverage results locally.


-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to