sage-doctest applies "backslash handling" to doctests, where a line that ends with a single backslash is merged with the next line (with the backslash removed). As far as I can tell, this makes it impossible to doctest something with an expected output having a line ending with a backslash.
This patch to the "hg_scripts" repository removes the behavior for expected outputs (but keeps backslash handling for inputs; that is, for lines beginning "sage:"). There was one doctest in Sage that depended on the previous behavior; the second patch modifies that doctest to pass with the new sage-doctest.