zhengruifeng opened a new pull request, #56396:
URL: https://github.com/apache/spark/pull/56396

   ### What changes were proposed in this pull request?
   This PR replaces misuses of `assertTrue` with `assertEqual` in PySpark test 
suites:
   
   1. `self.assertTrue(a == b)` -> `self.assertEqual(a, b)` (53 call sites 
across 22 files). A mechanical, behavior-preserving change.
   2. `self.assertTrue(df.columns, [...])` -> `self.assertEqual(df.columns, 
[...])` (4 call sites in `test_dataframe.py` and `test_column.py`). These 
passed the expected column list as the `assertTrue` *message* argument, so they 
only checked that `df.columns` is truthy and never compared the names. This is 
a bug fix.
   
   ### Why are the changes needed?
   - For `assertTrue(a == b)`: when the assertion fails, the message is only 
`AssertionError: False is not true`, which hides the operands. `assertEqual(a, 
b)` reports both sides (e.g. `5 != 9`), making failures easier to diagnose.
   - For `assertTrue(df.columns, [...])`: a non-empty list is always truthy, so 
the expected column names were never actually verified. `assertEqual` makes 
these tests check what they intended to.
   
   ### Does this PR introduce _any_ user-facing change?
   No. Test-only change.
   
   ### How was this patch tested?
   Existing tests. The `a == b` rewrites are equivalent to the originals (same 
`==` comparison). For the column assertions, the expected lists match the 
actual DataFrame columns, so the now-effective assertions pass.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   Generated-by: Claude Code (model: claude-opus-4-8)
   


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