diff --git a/sdks/python/apache_beam/typehints/typehints.py b/sdks/python/apache_beam/typehints/typehints.py index d18767d2847b..5726a8a8ca92 100644 --- a/sdks/python/apache_beam/typehints/typehints.py +++ b/sdks/python/apache_beam/typehints/typehints.py @@ -1043,6 +1043,8 @@ def _is_subclass_constraint(sub): FrozenSetTypeConstraint, SetTypeConstraint)) + # TODO(https://github.com/apache/beam/issues/29135): allow for consistency + # with Mapping types def _consistent_with_check_(self, sub): if self._is_subclass_constraint(sub): return is_consistent_with(sub.inner_type, self.inner_type) diff --git a/sdks/python/apache_beam/typehints/typehints_test.py b/sdks/python/apache_beam/typehints/typehints_test.py index d7e3832f7ec8..1d938edcc24b 100644 --- a/sdks/python/apache_beam/typehints/typehints_test.py +++ b/sdks/python/apache_beam/typehints/typehints_test.py @@ -873,6 +873,7 @@ def test_type_constraint_compatibility(self): self.assertCompatible( typehints.Collection[typehints.Any], typehints.Collection[int]) self.assertCompatible(typehints.Collection[int], typehints.Tuple[int]) + self.assertCompatible(typehints.Any, typehints.Collection[str]) def test_one_way_compatibility(self): self.assertNotCompatible(typehints.Set[int], typehints.Collection[int])