Skip to content

Commit

Permalink
better tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolaskruchten committed Jul 21, 2021
1 parent 458554a commit 1e24ca0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 2 additions & 0 deletions packages/python/plotly/plotly/io/_base_renderers.py
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,8 @@ def open_html_in_browser(html, using=None, new=0, autoraise=True):
for browser_key in using:
try:
browser = webbrowser.get(browser_key)
if browser is not None:
break
except webbrowser.Error:
pass

Expand Down
7 changes: 3 additions & 4 deletions packages/python/plotly/plotly/tests/test_io/test_renderers.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,8 @@ def test_browser_renderer_show(fig1, renderer):
pio.renderers.default = renderer
renderer_obj = pio.renderers[renderer]
using = renderer_obj.using
if isinstance(renderer_obj.using, tuple):
using = renderer_obj.using[0]
renderer_obj.using = using
if not isinstance(renderer_obj.using, tuple):
using = (using,)

# Setup mocks
mock_get = MagicMock(name="test get")
Expand All @@ -253,7 +252,7 @@ def open_url(url, new=0, autoraise=True):
pio.show(fig1)

# check get args
mock_get.assert_called_once_with(using)
mock_get.assert_any_call(using[0])

# check open args
mock_call_args = mock_browser.open.call_args
Expand Down

0 comments on commit 1e24ca0

Please sign in to comment.