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
5 changes: 4 additions & 1 deletion plotly/figure_factory/_quiver.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ def create_quiver(
for more information on valid kwargs call
help(plotly.graph_objs.Scatter)

:rtype (dict): returns a representation of quiver figure.
Returns
-------
plotly.graph_objects.Figure
A Plotly figure containing the quiver arrows.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Returns
-------
plotly.graph_objects.Figure
A Plotly figure containing the quiver arrows.
:rtype (plotly.graph_objects.Figure): returns a representation of quiver figure.


Example 1: Trivial Quiver

Expand Down
5 changes: 4 additions & 1 deletion plotly/figure_factory/_streamline.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@ def create_streamline(
for more information on valid kwargs call
help(plotly.graph_objs.Scatter)

:rtype (dict): returns a representation of streamline figure.
Returns
-------
plotly.graph_objects.Figure
A Plotly figure containing the streamlines and arrows.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Returns
-------
plotly.graph_objects.Figure
A Plotly figure containing the streamlines and arrows.
:rtype (plotly.graph_objects.Figure): returns a representation of streamline figure.


Example 1: Plot simple streamline and increase arrow size

Expand Down
28 changes: 28 additions & 0 deletions tests/test_optional/test_figure_factory/test_return_type_docs.py

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this file. We don't add tests for docstrings.

Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
"""Figure-factory return type documentation regression checks."""

import inspect

import pytest

import plotly.figure_factory as ff
from plotly.graph_objects import Figure


@pytest.mark.parametrize(
"factory, kwargs",
[
(ff.create_quiver, {"x": [0], "y": [0], "u": [1], "v": [1]}),
(
ff.create_streamline,
{
"x": [0, 1, 2],
"y": [0, 1, 2],
"u": [[1, 1, 1], [1, 1, 1], [1, 1, 1]],
"v": [[1, 1, 1], [1, 1, 1], [1, 1, 1]],
},
),
],
)
def test_factory_return_docs_match_runtime(factory, kwargs):
assert "Returns\n-------\nplotly.graph_objects.Figure" in inspect.getdoc(factory)
assert isinstance(factory(**kwargs), Figure)