Пример #1
0
    def test_save_helper_method(self, mock_file_html, mock_io_open):
        obj = Plot()
        filename, resources, title = io._get_save_args(io._state, "filename", "resources", "title")

        io._save_helper(obj, filename, resources, title)

        self._check_func_called(mock_file_html,
                                (obj, resources),
                                {"title": "title"})
        self._check_func_called(mock_io_open,
                                (filename,),
                                {"mode":"w", "encoding":"utf-8"})
Пример #2
0
    def test_obj_arg_is_document(self, mock_standalone_html_page,
                                 mock_io_open):
        obj = Document()
        filename, resources, title = io._get_save_args(io._state, "filename",
                                                       "resources", "title")
        io._save_helper(obj, filename, resources, title, True)

        self._check_func_called(mock_standalone_html_page,
                                (obj, resources, title), {})
        self._check_func_called(mock_io_open, (filename, ), {
            "mode": "w",
            "encoding": "utf-8"
        })