Exemple #1
0
 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))
Exemple #2
0
 def is_nullable(self) -> bool:
     return get_origin(self.type_obj) is Union and type(None) in get_args(
         self.type_obj)
Exemple #3
0
 def test_get_origin(tp):
     assert _get_args is not get_origin
     assert _get_origin(tp) == get_origin(tp)