Fix test for Python 2.6

assertRaises doesn't provide a context manager.