Add tests for quoteforpo

The last test is the critical one.  When line length sits on 77 chars then
somehow linewrap drops the \n that we had in before.  Very strange corner case
this one.
Fix readding \\n to manage len(ln) == 77

At 77 chars we end up with len(ln) == 2.  But the ln[-1] == ''.  And 'if
ln[-1]' evals to False so we don't add back the \n

Took an age to debug this. Hopefully it doesn't introduce some other issues.
Check if inputfile has name attribute prior to check if it is Android DTD