From 1db8fe74d0b5875f67777052e18a51b5a1e01166 Mon Sep 17 00:00:00 2001 From: Fabian Degen Date: Thu, 24 Oct 2024 09:33:08 +0200 Subject: [PATCH] fix ruff format --- python/interpret-core/interpret/visual/plot.py | 4 +--- python/interpret-core/tests/visual/test_plot.py | 10 ++++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/python/interpret-core/interpret/visual/plot.py b/python/interpret-core/interpret/visual/plot.py index 282c6675f..077f483f0 100644 --- a/python/interpret-core/interpret/visual/plot.py +++ b/python/interpret-core/interpret/visual/plot.py @@ -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. diff --git a/python/interpret-core/tests/visual/test_plot.py b/python/interpret-core/tests/visual/test_plot.py index 24acc649b..dd30902ef 100644 --- a/python/interpret-core/tests/visual/test_plot.py +++ b/python/interpret-core/tests/visual/test_plot.py @@ -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"], @@ -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] \ No newline at end of file + assert "100T - 1.00e+15" in figure.layout.xaxis.ticktext[1]