Skip to content

Commit bb0a5a2

Browse files
jsignellshoyer
authored andcommitted
Escaping dtypes (#3444)
* Escaping dtypes * Reformatting
1 parent ba48fbc commit bb0a5a2

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

xarray/core/formatting_html.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def summarize_variable(name, var, is_index=False, dtype=None, preview=None):
9696
cssclass_idx = " class='xr-has-index'" if is_index else ""
9797
dims_str = f"({', '.join(escape(dim) for dim in var.dims)})"
9898
name = escape(name)
99-
dtype = dtype or var.dtype
99+
dtype = dtype or escape(str(var.dtype))
100100

101101
# "unique" ids required to expand/collapse subsections
102102
attrs_id = "attrs-" + str(uuid.uuid4())

xarray/tests/test_formatting_html.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,3 +130,5 @@ def test_repr_of_dataset(dataset):
130130
assert (
131131
formatted.count("class='xr-section-summary-in' type='checkbox' checked>") == 3
132132
)
133+
assert "<U4" in formatted
134+
assert "<IA>" in formatted

0 commit comments

Comments
 (0)