Skip to content

Commit 2bc5258

Browse files
committed
Add test for rounding
1 parent e4478e5 commit 2bc5258

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

Diff for: packages/python/plotly/plotly/tests/test_core/test_subplots/test_make_subplots.py

+16-2
Original file line numberDiff line numberDiff line change
@@ -660,6 +660,22 @@ def test_specs_padding(self):
660660
)
661661
self.assertEqual(fig.to_plotly_json(), expected.to_plotly_json())
662662

663+
def test_specs_rounding_rounds_down(self):
664+
n_subplots = 8
665+
padding_size = 0.2
666+
667+
specs = []
668+
for _ in range(n_subplots):
669+
specs.append([{"b": padding_size / 2.0, "t": padding_size / 2.0}])
670+
671+
fig = tls.make_subplots(rows=n_subplots, specs=specs)
672+
self.assertTrue(
673+
all(
674+
fig.layout[f"yaxis{i if i > 1 else ''}"]["domain"][0] <= 1.0
675+
for i in range(1, n_subplots+1)
676+
)
677+
)
678+
663679
def test_specs_padding_bottom_left(self):
664680
expected = Figure(
665681
data=Data(),
@@ -1592,7 +1608,6 @@ def test_large_columns_no_errors(self):
15921608
)
15931609

15941610
def test_row_width_and_column_width(self):
1595-
15961611
expected = Figure(
15971612
{
15981613
"data": [],
@@ -1680,7 +1695,6 @@ def test_row_width_and_column_width(self):
16801695
self.assertEqual(fig.to_plotly_json(), expected.to_plotly_json())
16811696

16821697
def test_row_width_and_shared_yaxes(self):
1683-
16841698
expected = Figure(
16851699
{
16861700
"data": [],

0 commit comments

Comments
 (0)