You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Ensure both triangles have the same column order
x=x[new_x_cols]
y=y[new_x_cols]
# Reset backends only if they've changed
ifx.array_backend!=x_backend:
x=x.set_backend(x_backend, inplace=True)
ify.array_backend!=y_backend:
y=y.set_backend(y_backend, inplace=True)
returnx, y
How can the bug be reproduced?
This was discovered when trying to write unit tests for them. This diagnostic was generated by Claude, so I want to double check whether it's correct before we remove the lines:
● These lines are dead code — the backend never changes inside _prep_columns. Here's why: 1. _prep_columns is always called after _compatibility_check, which calls set_common_backend to align both triangles to the same backend before we get here. 2. None of the operations inside _prep_columns (vdims assignment, reindex, column slicing) change the backend — I verified this empirically with a monkey-patch that would detect any change. So x.array_backend != x_backend and y.array_backend != y_backend are always False, and lines 146/148 can never execute. There's no test that can reach them.
What is the expected behavior?
My IDE detects that there's only 1 usage of TriangleDunders._prep_columns(), and it does occur after _compatibility_check(), so item 1 is correct. We just need to check item 2 before we remove the lines.
Are you on the latest chainladder version?
Describe the bug in words
Lines 147 - 150 can't be reached:
chainladder-python/chainladder/core/dunders.py
Lines 114 to 152 in 6f80200
How can the bug be reproduced?
This was discovered when trying to write unit tests for them. This diagnostic was generated by Claude, so I want to double check whether it's correct before we remove the lines:
What is the expected behavior?
My IDE detects that there's only 1 usage of
TriangleDunders._prep_columns(), and it does occur after_compatibility_check(), so item 1 is correct. We just need to check item 2 before we remove the lines.Would you be willing to contribute this ticket?