Why not `self.assertRaises(ValueError, RawData, object())`? It is cleaner than a lot of lambdas. You did it in other lines too.