Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf667bc4

Browse files
committed
add test to make sure plotly.io.get_chrome() is exposed
1 parent5d6246b commitf667bc4

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

‎tests/test_optional/test_kaleido/test_kaleido.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,3 +293,29 @@ def test_fig_to_image():
293293
mock_calc_fig.assert_called_once()
294294
args,_=mock_calc_fig.call_args
295295
assertargs[0]==test_fig.to_dict()
296+
297+
298+
deftest_get_chrome():
299+
"""Test that plotly.io.get_chrome() can be called."""
300+
301+
withpatch(
302+
"plotly.io._kaleido.kaleido.get_chrome_sync",
303+
return_value="/mock/path/to/chrome",
304+
)asmock_get_chrome:
305+
withpatch("builtins.input",return_value="y"):# Mock user confirmation
306+
withpatch(
307+
"sys.argv", ["plotly_get_chrome","-y"]
308+
):# Mock CLI args to skip confirmation
309+
ifnotkaleido_available()orkaleido_major()<1:
310+
# Test that ValueError is raised when Kaleido requirements aren't met
311+
withpytest.raises(
312+
ValueError,
313+
match="This command requires Kaleido v1.0.0 or greater",
314+
):
315+
pio.get_chrome()
316+
else:
317+
# Test normal operation when Kaleido v1+ is available
318+
pio.get_chrome()
319+
320+
# Verify that kaleido.get_chrome_sync was called
321+
mock_get_chrome.assert_called_once()

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp