-
-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Show the right style options with the help function (#754)
- Loading branch information
Showing
3 changed files
with
68 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,6 +45,7 @@ nosetests.xml | |
coverage.xml | ||
*.cover | ||
.hypothesis/ | ||
.pytest_cache | ||
|
||
# Translations | ||
*.mo | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import hvplot.pandas | ||
import pytest | ||
|
||
from holoviews.core import Store | ||
from holoviews.element import Curve | ||
|
||
|
||
@pytest.fixture | ||
def reset_default_backend(): | ||
yield | ||
hvplot.extension('bokeh') | ||
hvplot.extension.compatibility = None | ||
|
||
|
||
def test_help_style_extension_output(reset_default_backend): | ||
# default, after e.g. import hvplot.pandas | ||
docstring, signature = hvplot._get_doc_and_signature( | ||
cls=hvplot.hvPlot, | ||
kind='line', | ||
completions=False, | ||
docstring=False, | ||
generic=False, | ||
style=True, | ||
signature=None, | ||
) | ||
assert docstring == '\nStyle options\n-------------\n\n' + '\n'.join(sorted(Store.registry['bokeh'][Curve].style_opts)) | ||
|
||
# The current backend becomes matplotlib | ||
hvplot.extension('matplotlib', 'plotly') | ||
docstring, signature = hvplot._get_doc_and_signature( | ||
cls=hvplot.hvPlot, | ||
kind='line', | ||
completions=False, | ||
docstring=False, | ||
generic=False, | ||
style=True, | ||
signature=None, | ||
) | ||
assert docstring == '\nStyle options\n-------------\n\n' + '\n'.join(sorted(Store.registry['matplotlib'][Curve].style_opts)) | ||
|
||
# The current backend becomes plotly | ||
hvplot.output(backend='plotly') | ||
docstring, signature = hvplot._get_doc_and_signature( | ||
cls=hvplot.hvPlot, | ||
kind='line', | ||
completions=False, | ||
docstring=False, | ||
generic=False, | ||
style=True, | ||
signature=None, | ||
) | ||
assert docstring == '\nStyle options\n-------------\n\n' + '\n'.join(sorted(Store.registry['plotly'][Curve].style_opts)) | ||
|
||
def test_help_style_compatibility(reset_default_backend): | ||
# The current backend is plotly but the style options are those of matplotlib | ||
hvplot.extension('plotly', 'matplotlib', compatibility='matplotlib') | ||
docstring, signature = hvplot._get_doc_and_signature( | ||
cls=hvplot.hvPlot, | ||
kind='line', | ||
completions=False, | ||
docstring=False, | ||
generic=False, | ||
style=True, | ||
signature=None, | ||
) | ||
assert docstring == '\nStyle options\n-------------\n\n' + '\n'.join(sorted(Store.registry['matplotlib'][Curve].style_opts)) |