def METHOD_NAME(self):
    class TestClass(HasTraits):
        int_or_str_type = Union(Type, Int, Str)
    TestClass(int_or_str_type=3)
    TestClass(int_or_str_type="3.5")
    with self.assertRaises(TraitError):
        TestClass(int_or_str_type=3.5)
    with self.assertRaises(TraitError):
        TestClass(int_or_str_type=Int(3))