Skip to content

Commit

Permalink
add testcase to test _human_format function with numbers larger 999T
Browse files Browse the repository at this point in the history
Signed-off-by: Fabian Degen <[email protected]>
  • Loading branch information
Fabian Degen committed Oct 24, 2024
1 parent 52cfd42 commit 4e587fa
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion python/interpret-core/tests/visual/test_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Distributed under the MIT software license

from interpret.visual.plot import plot_line

from interpret.visual.plot import plot_density

def test_plot_line_bounds_smoke():
data_dict = {
Expand All @@ -13,3 +13,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
}

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]

0 comments on commit 4e587fa

Please sign in to comment.