def type_of_iterable_views_is_sniffed_from_elements(): assert_equal(types.iterable(types.describe(int)), describe_type_of({1: "Kentucky Pill"}.keys())) assert_equal(types.iterable(types.describe(str)), describe_type_of({1: "Kentucky Pill"}.values())) assert_equal( types.iterable(types.tuple_((types.describe(int), types.describe(str)))), describe_type_of({1: "Kentucky Pill"}.items()), )
def iterable_uses_iterable_class_from_pep_484(): assert_equal("Iterable[int]", format_type(types.iterable(types.describe(int))))