    def assert_line_equals(self, canvas, expected, y=0, length=None):
        """
        Assert first line of output to canvas is as expected.
        """
        output = ""
        for x in range(canvas.width):
            char, _, _, _ = canvas.get_from(x, y)
            output += chr(char)
        if length:
            self.assertEqual(output[:length], expected[:length])
        else:
            self.assertEqual(output, expected)
Assert first line of output to canvas is as expected.
tests/test_screen.py