The semantics here are different than the assert_raises semantics, since this requires an exact match, while assert_raises only requires a (proper) subclass.

That said, I think the assert_raises semantics are unexpected and should be made to require exact match.