Repository navigation
SWR pydata__xarray-3900 - #51
richeshgupta wants to merge 1 commit into
Conversation
| max_width = OPTIONS["display_width"] | ||
| max_width_options = OPTIONS["display_width"] | ||
| if not isinstance(max_width_options, int): | ||
| raise TypeError(f"`max_width` value of `{max_width}` is not a valid int") |
There was a problem hiding this comment.
[MEDIUM] Untested display_width type guard raises a TypeError that always reports the offending value as None
Issue
The new guard on OPTIONS['display_width'] is reachable via xr.set_options(display_width='80') followed by any Dataset repr, but no test added or updated in this diff exercises the raise. When it fires, max_width is still None, so the f-string interpolates the parameter rather than max_width_options and the message never shows the actual offending value.
Evidence
SUSPECTED: the raise executes only when max_width is None, so the message renders None instead of the offending value, and no test in the diff reaches the raise. A test in xarray/tests/test_options.py — with pytest.raises(TypeError, match='80'): with xr.set_options(display_width='80'): repr(ds) — would settle it and fails as written.
SWRBench case pydata__xarray-3900: pinned base 6378a71 to head 793f7fd of pydata#3900. Benchmark replay, not for merge.