Fixes to testing.
Lots of changes everywhere to make more tests pass. Note that in some
cases, this meant disabling some examples as doctests, because they
may require deeper changes. No actual examples have been removed,
I've just changed their prompts from '>>>' to 'py>' or from 'In [N]'
to 'In []' so they won't get picked up as doctests.