Skip to content

Commit c009b44

Browse files
Fix state accumulation bug in test_gsp_support_monotonicity
Co-authored-by: jacksonpradolima <[email protected]>
1 parent 6744242 commit c009b44

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

tests/test_gsp_fuzzing.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,14 +100,18 @@ def test_gsp_support_monotonicity(transactions: List[List[str]]) -> None:
100100
If we decrease the minimum support threshold, we should get
101101
at least as many patterns (or more) than with a higher threshold.
102102
"""
103-
gsp = GSP(transactions)
103+
# Use separate GSP instances to avoid state accumulation between searches
104+
# on different min_support thresholds.
104105

105106
# Test with two different support levels
106107
high_support = 0.5
107108
low_support = 0.2
108109

109-
result_high = gsp.search(min_support=high_support)
110-
result_low = gsp.search(min_support=low_support)
110+
gsp_high = GSP(transactions)
111+
gsp_low = GSP(transactions)
112+
113+
result_high = gsp_high.search(min_support=high_support)
114+
result_low = gsp_low.search(min_support=low_support)
111115

112116
# Count total patterns at each support level
113117
patterns_high = sum(len(level) for level in result_high)

0 commit comments

Comments
 (0)