Update doctest to use syntax suitable for Python 2 and Python 3. Credit to Lennart Regebro for the [hints in his book](http://python3porting.com/problems.html#handling-expected-exceptions).