Skip to content
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

Fix reporting of bad inputs in LiteralInput widget (#202). #203

Merged

Conversation

lebedov
Copy link
Contributor

@lebedov lebedov commented Jan 7, 2019

No description provided.

@codecov-io
Copy link

Codecov Report

Merging #203 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #203      +/-   ##
==========================================
+ Coverage   90.06%   90.06%   +<.01%     
==========================================
  Files          30       30              
  Lines        4872     4874       +2     
==========================================
+ Hits         4388     4390       +2     
  Misses        484      484
Impacted Files Coverage Δ
panel/widgets.py 95.63% <100%> (+0.01%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ef6eb2e...8efca0e. Read the comment docs.

@philippjfr
Copy link
Member

Thanks for the PR. Would you mind adding a test to try to cover the case this is trying to fix?

@lebedov
Copy link
Contributor Author

lebedov commented Jan 7, 2019

Assuming I've understood the unit tests correctly, the last assert in the following code should fail on the bug I observed:

from pyviz_comms import Comm
from bokeh.document import Document
from panel.widgets import LiteralInput

doc = Document()
comm = Comm()

literal = LiteralInput(value=0, type=int, name='Literal')
box = literal._get_model(doc, comm=comm)
widget = box.children[0]
assert widget.title == 'Literal'
literal._comm_change({'value': "invalid"})
assert widget.title == 'Literal (invalid)'
literal._comm_change({'value': "also invalid"})
assert widget.title == 'Literal (invalid)'

However, I don't observe any error when I run it at the command line with unpatched Panel 0.3.1 and pyviz_comm 0.7.0 installed; I can only observe the error (i.e., the title changing from "Literal (invalid)" to "Literal" when I change the contents of the box from "invalid" to "also invalid") if I create a widget in Jupyter Notebook or Lab as follows and try modifying the data in the displayed input box as described:

import panel
from panel.widgets import LiteralInput
panel.extension()
w = LiteralInput(value=0, type=int, name='Literal')
w

Thoughts?

@philippjfr
Copy link
Member

I'll try to look into it, also worth noting that the bug doesn't occur on bokeh server so it's something going wrong when syncing the model state in the notebook.

@philippjfr
Copy link
Member

I'll merge this without the unit test for now, but will look into the syncing issues this PR highlights.

@philippjfr philippjfr merged commit 590a89b into holoviz:master Jan 8, 2019
@lebedov lebedov deleted the fix-literal-input-invalid-value-reporting branch January 8, 2019 20:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants