def is_many(self) -> bool: origin = get_origin(self.type_obj) return isinstance( origin, type) and (issubclass(origin, collections.abc.Container) or issubclass(origin, collections.abc.Iterable) or issubclass(origin, collections.abc.Sized))
def is_nullable(self) -> bool: return get_origin(self.type_obj) is Union and type(None) in get_args( self.type_obj)
def test_get_origin(tp): assert _get_args is not get_origin assert _get_origin(tp) == get_origin(tp)