Skip to content

Commit

Permalink
last bit of test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
almarklein committed Oct 30, 2023
1 parent 1e0c94f commit e4e9b6d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
19 changes: 11 additions & 8 deletions tests/test_diagnostics.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,23 +132,26 @@ class GPUFooBar:


def test_dict_to_text_simple():
d = {"foo": {"a": 1, "b": 2, "c": 3}, "bar": {"a": 4, "b": 5, "c": 6}}
d = {
"foo": {"a": 1, "b": 2, "c": 3.1000000},
"bar": {"a": 4, "b": 5, "c": 6.123456789123},
}

reference = """
title a b c
title a b c
foo 1 2 3
bar 4 5 6
foo 1 2 3.1
bar 4 5 6.12346
"""
assert dict_to_text(d, ["title", "a", "b", "c"]) == dedent(reference[1:], 8)

reference = """
title c a
title b a
foo 3 1
bar 6 4
foo 2 1
bar 5 4
"""
assert dict_to_text(d, ["title", "c", "a"]) == dedent(reference[1:], 8)
assert dict_to_text(d, ["title", "b", "a"]) == dedent(reference[1:], 8)


def test_dict_to_text_justification():
Expand Down
2 changes: 1 addition & 1 deletion wgpu/_diagnostics.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def dict_to_table(d, header, header_offest=0):
extrarows = [[""] * i + subrow for subrow in subrows[1:]]
rows.extend(extrarows)
break # header items are consumed by the sub
else:
else: # no-cover
raise TypeError(f"Unexpected table value: {val}")

return rows
Expand Down

0 comments on commit e4e9b6d

Please sign in to comment.