Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion plotly/_subplots.py
Original file line number Diff line number Diff line change
Expand Up @@ -1425,7 +1425,7 @@ def _set_trace_grid_reference(trace, layout, grid_ref, row, col, secondary_y=Fal
Subplot with type '{subplot_type}' at grid position ({row}, {col}) was not
created with the secondary_y spec property set to True. See the docstring
for the specs argument to plotly.subplots.make_subplots for more information.
"""
""".format(subplot_type=subplot_refs[0].subplot_type, row=row, col=col)
)
trace_kwargs = subplot_refs[1].trace_kwargs
else:
Expand Down
2 changes: 1 addition & 1 deletion plotly/io/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def validate_coerce_output_type(output_type):
raise ValueError(
"""
Invalid output type: {output_type}
Must be one of: 'Figure', 'FigureWidget'"""
Must be one of: 'Figure', 'FigureWidget'""".format(output_type=output_type)
)
return cls

Expand Down
9 changes: 9 additions & 0 deletions tests/test_core/test_subplots/test_make_subplots.py
Original file line number Diff line number Diff line change
Expand Up @@ -2038,3 +2038,12 @@ def test_make_subplots_spacing_error():
ValueError, match=r"^Vertical spacing must be between 0 and 1\.$"
):
subplots.make_subplots(1, 1, vertical_spacing=1.01)


def test_secondary_y_without_spec_error():
fig = subplots.make_subplots(rows=1, cols=2)
with pytest.raises(
ValueError,
match=r"Subplot with type 'xy' at grid position \(1, 2\) was not",
):
fig.add_scatter(x=[1], y=[1], row=1, col=2, secondary_y=True)
5 changes: 5 additions & 0 deletions tests/test_io/test_to_from_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,11 @@ def test_from_json_invalid(fig1):
pio.from_json(bad_json)


def test_from_json_invalid_output_type(fig1):
with pytest.raises(ValueError, match="Invalid output type: Bogus"):
pio.from_json(pio.to_json(fig1), output_type="Bogus")


def test_from_json_skip_invalid(fig1):
dict1 = fig1.to_dict()

Expand Down