コード例 #1
0
    def test_preprocess_code_cell_solution(self):
        """Is the solution version of a code cell correctly preprocessed?"""
        self.preprocessor.solution = True
        self.preprocessor.toc = ""
        cell = self._create_code_cell()

        self.preprocessor._create_client()
        cell, resources = self.preprocessor.preprocess_cell(cell, {}, 1)
        self.preprocessor._shutdown_client()

        output = NotebookNode()
        output.stream = "stdout"
        output.text = "hello\n"
        output.output_type = "stream"

        assert cell.input == """# YOUR CODE HERE\nprint "hello\""""
        assert cell.outputs == [output]
        assert cell.prompt_number == 1