def METHOD_NAME(self):
    class Foo(HasTraits):
        mapping = Dict(Any, Str)
    foo = Foo(mapping={})
    # This is okay
    foo.mapping["a"] = "1"
    # This raises
    with self.assertRaises(TraitError):
        foo.mapping["a"] = 1