Skip to content

Commit

Permalink
fix ruff format
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabian Degen committed Oct 24, 2024
1 parent 4e587fa commit 1db8fe7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 1 addition & 3 deletions python/interpret-core/interpret/visual/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,7 @@ def _human_format(num):
while abs(num) >= 1000:
magnitude += 1
num /= 1000.0
return "{}{}".format(
f"{num:f}".rstrip("0").rstrip("."), suffixes[magnitude]
)
return "{}{}".format(f"{num:f}".rstrip("0").rstrip("."), suffixes[magnitude])


# TODO: Clean this up after validation.
Expand Down
10 changes: 6 additions & 4 deletions python/interpret-core/tests/visual/test_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from interpret.visual.plot import plot_line
from interpret.visual.plot import plot_density


def test_plot_line_bounds_smoke():
data_dict = {
"names": ["a", "b", "c"],
Expand All @@ -14,17 +15,18 @@ def test_plot_line_bounds_smoke():
figure = plot_line(data_dict)
assert figure.data[0].name == "Lower Bound"


def test_plot_density_large_numbers():
"""
Test that density plots handle large numbers correctly using the new number formatting
"""
data_dict = {
"scores": [1.0, 1.0],
"names": [9e13, 1e14, 1e15] # 1e15 value will trigger new formatting
"names": [9e13, 1e14, 1e15], # 1e15 value will trigger new formatting
}

figure = plot_density(data_dict)

# The x-axis tick text should show ranges using our new formatting
assert "90T - 100T" in figure.layout.xaxis.ticktext[0]
assert "100T - 1.00e+15" in figure.layout.xaxis.ticktext[1]
assert "100T - 1.00e+15" in figure.layout.xaxis.ticktext[1]

0 comments on commit 1db8fe7

Please sign in to comment.