def validate(value): if not utils.is_name_safe(value): raise exception.InvalidName(name=value) return value
def test_InvalidName(self): self.assertRaises(exception.InvalidName, lambda: self.raise_(exception.InvalidName()))