(fig1, name, connected)
| 176 | [("notebook", False), ("notebook_connected", True), ("kaggle", True)], |
| 177 | ) |
| 178 | def test_notebook_connected_show(fig1, name, connected): |
| 179 | # Set renderer |
| 180 | pio.renderers.default = name |
| 181 | |
| 182 | # Show |
| 183 | with mock.patch("IPython.display.display_html") as mock_display_html: |
| 184 | with mock.patch("IPython.display.display") as mock_display: |
| 185 | pio.show(fig1) |
| 186 | |
| 187 | # Check initialization |
| 188 | # Get display call arguments |
| 189 | mock_call_args_html = mock_display_html.call_args |
| 190 | mock_arg1_html = mock_call_args_html[0][0] |
| 191 | |
| 192 | # Check init display contents |
| 193 | bundle_display_html = mock_arg1_html |
| 194 | if connected: |
| 195 | assert_html_renderer_connected(bundle_display_html) |
| 196 | else: |
| 197 | assert_offline(bundle_display_html) |
| 198 | |
| 199 | # Check display call |
| 200 | # Get display call arguments |
| 201 | mock_call_args = mock_display.call_args |
| 202 | mock_arg1 = mock_call_args[0][0] |
| 203 | |
| 204 | # Check for html bundle |
| 205 | assert list(mock_arg1) == ["text/html"] |
| 206 | |
| 207 | # Check html display contents |
| 208 | bundle_html = mock_arg1["text/html"] |
| 209 | assert_not_full_html(bundle_html) |
| 210 | |
| 211 | # check kwargs |
| 212 | mock_kwargs = mock_call_args[1] |
| 213 | assert mock_kwargs == {"raw": True} |
| 214 | |
| 215 | |
| 216 | # Browser |
nothing calls this directly
no test coverage detected