Skip to content

Commit 6ba106d

Browse files
CopilotMMathisLab
andcommitted
Add clarifying comments about implementation details
- Explain why only first check is returned ([0] behavior) - Document fragility of accessing decorator internals - Improve code maintainability Co-authored-by: MMathisLab <[email protected]>
1 parent 017b7fd commit 6ba106d

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

tests/_util.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,15 @@ def parametrize_with_checks_slow(fast_arguments, slow_arguments, generate_only=T
8181
supports_generate_only = 'generate_only' in check_estimator_sig.parameters
8282

8383
def _get_first_check_for_estimator(estimator):
84-
"""Helper to get the first check for a given estimator in new sklearn API."""
84+
"""Helper to get the first check for a given estimator in new sklearn API.
85+
86+
Note: We only return the first check to match the original behavior with [0].
87+
This maintains consistency with the legacy API which also returned [0].
88+
"""
8589
try:
8690
decorator = sklearn.utils.estimator_checks.parametrize_with_checks([estimator])
87-
# Extract the generator from the decorator
91+
# Extract the generator from the decorator's internal structure
92+
# Note: This accesses pytest/sklearn internals and may be fragile across versions
8893
gen = decorator.mark.args[1]
8994
# Convert to list and take first element to avoid generator exhaustion issues
9095
checks_list = list(gen)

0 commit comments

Comments
 (0)