def test__save_helper(mock_file_html, mock_io_open): obj = Plot() filename, resources, title = bis._get_save_args(curstate(), "filename", "resources", "title") bis._save_helper(obj, filename, resources, title) assert mock_file_html.call_count == 1 assert mock_file_html.call_args[0] == (obj, resources) assert mock_file_html.call_args[1] == {"title": "title"} assert mock_io_open.call_count == 1 assert mock_io_open.call_args[0] == (filename,) assert mock_io_open.call_args[1] == {"mode":"w", "encoding":"utf-8"}
def test__save_helper(mock_file_html, mock_io_open): obj = Plot() filename, resources, title = bis._get_save_args(curstate(), "filename", "resources", "title") bis._save_helper(obj, filename, resources, title) assert mock_file_html.call_count == 1 assert mock_file_html.call_args[0] == (obj, resources) assert mock_file_html.call_args[1] == {"title": "title"} assert mock_io_open.call_count == 1 assert mock_io_open.call_args[0] == (filename,) assert mock_io_open.call_args[1] == {"mode":"w", "encoding":"utf-8"}
def test__save_helper(mock_file_html, mock_io_open): obj = Plot() filename, resources, title = bis._get_save_args(curstate(), "filename", "resources", "title") bis._save_helper(obj, filename, resources, title, None) assert mock_file_html.call_count == 1 assert mock_file_html.call_args[0] == (obj, resources) assert mock_file_html.call_args[1] == dict(title="title", template=None) assert mock_io_open.call_count == 1 assert mock_io_open.call_args[0] == (filename,) assert mock_io_open.call_args[1] == dict(mode="w", encoding="utf-8")
def test__save_helper(mock_file_html, mock_io_open): obj = Plot() filename, resources, title = bis._get_save_args(curstate(), "filename", "resources", "title") bis._save_helper(obj, filename, resources, title, None) assert mock_file_html.call_count == 1 assert mock_file_html.call_args[0] == (obj, resources) assert mock_file_html.call_args[1] == dict(title="title", template=None) assert mock_io_open.call_count == 1 assert mock_io_open.call_args[0] == (filename, ) assert mock_io_open.call_args[1] == dict(mode="w", encoding="utf-8")
def test__save_helper(mock_file_html: MagicMock, mock_open: MagicMock) -> None: obj = Plot() filename, resources, title = bis._get_save_args(curstate(), "filename", "inline", "title") bis._save_helper(obj, filename, resources, title, None) assert mock_file_html.call_count == 1 assert mock_file_html.call_args[0] == (obj, resources) assert mock_file_html.call_args[1] == dict(title="title", template=FILE, theme=None) assert mock_open.call_count == 1 assert mock_open.call_args[0] == (filename, ) assert mock_open.call_args[1] == dict(mode="w", encoding="utf-8")