AdithyaSK's picture
AdithyaSK HF Staff
Publish 100 swe_next Harbor tasks
d40299b verified
|
Raw History Blame
1.61 kB
## Bug: `GUIDerator` error message says `20 < size <= 36` but 20 is actually a valid size
The `GUIDerator` class accepts sizes between 20 and 36 inclusive (the guard is `if size < 20 or size > 36`), and the docstring confirms this. However, the `ValueError` raised for out-of-range sizes says `expected 20 < size <= 36`, which incorrectly implies that `size=20` is invalid.
This inconsistency becomes apparent when you check the error message for an invalid size:
```python
from boltons.iterutils import GUIDerator
# size=20 is accepted without error (correct behavior)
g = GUIDerator(size=20)
print(len(next(g))) # prints 20
# but passing size=19 raises a misleading error message
try:
GUIDerator(size=19)
except ValueError as e:
print(e) # prints: expected 20 < size <= 36
```
The error message `expected 20 < size <= 36` is wrong — it suggests 20 is not a valid size, but `GUIDerator(size=20)` works fine. The message should say `expected 20 <= size <= 36` to accurately reflect the inclusive lower bound.
**Expected behavior:** When an out-of-range size like 19 or 37 is passed, the `ValueError` message should read `expected 20 <= size <= 36`.
**Actual behavior:** The message reads `expected 20 < size <= 36`, which contradicts both the actual validation logic and the documented valid range.
Work in `/workspace`. Submit your fix in the existing Python source files under `boltons`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.