-
-
Notifications
You must be signed in to change notification settings - Fork 82
Expanded range info shown in HTML repr #821
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
433e917
Expanded range info shown in HTML repr
jbednar bcb8a4c
replace deprecated API
maximlt 600c7b2
handle class_ as tuple
maximlt 0fa2f85
Merge branch 'main' into rangerepr
maximlt c4e90dd
refactor tests
maximlt d1cfbf8
remove name from title
maximlt d7244b5
small fix and additional tests for the title
maximlt 3836e04
remove doc column
maximlt e7c4d0c
align Name header to the left
maximlt 9f9830b
increase tooltip width
maximlt af1465d
remove bottom margin under name
maximlt 7eaf157
don't center the tooltip text
maximlt f67b710
help cursor when hovering over the name
maximlt 094722c
avoid joining empty strings
maximlt c8ed056
show allow_None instead
maximlt bf723f6
explicit regex
maximlt f0e3a09
Removed redundant default range indicators
jbednar a289244
Switched from mathematical range notation to Python expr
jbednar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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,62 @@ | ||
| import param | ||
| import pytest | ||
|
|
||
| from param.parameterized import _parameterized_repr_html | ||
|
|
||
|
|
||
| class TestHTMLRepr: | ||
|
|
||
| @pytest.fixture | ||
| def Sub(self): | ||
| class Sub(param.Parameterized): | ||
| xsub = param.Parameter() | ||
|
|
||
| return Sub | ||
|
|
||
| @pytest.fixture | ||
| def P(self, Sub): | ||
| class P(param.Parameterized): | ||
| constant = param.Parameter(constant=True) | ||
| readonly = param.Parameter(readonly=True) | ||
| allow_None = param.Parameter(1, allow_None=False) | ||
| bounds = param.Number(bounds=(-10, 10)) | ||
| objects_list = param.Selector(objects=[1, 2]) | ||
| objects_dict = param.Selector(objects=dict(a=1, b=2)) | ||
| sub = param.ClassSelector(default=Sub(xsub=1), class_=Sub) | ||
|
|
||
| return P | ||
|
|
||
| def test_repr_in_place(self): | ||
| assert hasattr(param.Parameterized.param, '_repr_html_') | ||
| assert hasattr(param.Parameterized().param, '_repr_html_') | ||
|
|
||
| def test_html_repr_class_str(self, P): | ||
| html = P.param._repr_html_() | ||
| assert isinstance(html, str) | ||
|
|
||
| def test_html_repr_inst_str(self, P): | ||
| html = P().param._repr_html_() | ||
| assert isinstance(html, str) | ||
|
|
||
| def test_html_repr_class_sub(self, P): | ||
| html = P.param._repr_html_() | ||
| assert '<details >\n <summary style="display:list-item; outline:none;">\n <tt>Sub' in html | ||
|
|
||
| def test_html_repr_inst_sub(self, P): | ||
| html = P().param._repr_html_() | ||
| assert '<details >\n <summary style="display:list-item; outline:none;">\n <tt>Sub' in html | ||
|
|
||
| def test_html_repr_ClassSelector_tuple(self): | ||
| class P(param.Parameterized): | ||
| c = param.ClassSelector(class_=(str, int)) | ||
|
|
||
| rhtml = _parameterized_repr_html(P, True) | ||
| assert 'str | int' in rhtml | ||
|
|
||
| def test_html_repr_title_class(self, P): | ||
| html = P.param._repr_html_() | ||
| assert '<tt>P</tt>' in html | ||
|
|
||
| def test_html_repr_title_instance(self, P): | ||
| html = P().param._repr_html_() | ||
| assert '<tt>P()</tt>' in html |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.