    def assert_canvas_equals(self, canvas, expected, height=10, width=75):
        """
        Assert output to canvas/screen is as expected.
        """
        # TODO: Merge with widget test function of the same name.
        output = ""
        for y in range(height):
            for x in range(width):
                try:
                    char, _, _, _ = canvas.get_from(x, y)
                except Exception:
                    raise RuntimeError(f"{x} {y}")
                output += chr(char)
            output += "\n"
        self.assertEqual(output, expected)
Assert output to canvas/screen is as expected.
tests/test_screen.py