diff --git a/sdks/python/apache_beam/runners/interactive/sql/utils.py b/sdks/python/apache_beam/runners/interactive/sql/utils.py index 471240ee7b566..1be17f2c911ae 100644 --- a/sdks/python/apache_beam/runners/interactive/sql/utils.py +++ b/sdks/python/apache_beam/runners/interactive/sql/utils.py @@ -115,8 +115,7 @@ def pformat_namedtuple(schema: NamedTuple) -> str: return '{}({})'.format( schema.__name__, ', '.join([ - '{}: {}'.format(k, v.__name__ if hasattr(v, '__name__') else repr(v)) - for k, + '{}: {}'.format(k, repr(v)) for k, v in schema.__annotations__.items() ])) diff --git a/sdks/python/apache_beam/typehints/native_type_compatibility.py b/sdks/python/apache_beam/typehints/native_type_compatibility.py index 4be0b30e7c998..2a54450e212a7 100644 --- a/sdks/python/apache_beam/typehints/native_type_compatibility.py +++ b/sdks/python/apache_beam/typehints/native_type_compatibility.py @@ -192,6 +192,12 @@ def convert_to_beam_type(typ): # TODO(https://github.com/apache/beam/issues/19954): Currently unhandled. _LOGGER.info('Converting string literal type hint to Any: "%s"', typ) return typehints.Any + elif sys.version_info >= (3, 10) and isinstance(typ, typing.NewType): # pylint: disable=isinstance-second-argument-not-valid-type + # Special case for NewType, where, since Python 3.10, NewType is now a class + # rather than a function. + # TODO(https://github.com/apache/beam/issues/20076): Currently unhandled. + _LOGGER.info('Converting NewType type hint to Any: "%s"', typ) + return typehints.Any elif getattr(typ, '__module__', None) != 'typing': # Only translate types from the typing module. return typ diff --git a/sdks/python/apache_beam/typehints/row_type.py b/sdks/python/apache_beam/typehints/row_type.py index b1f6fd99d979f..7451a79476408 100644 --- a/sdks/python/apache_beam/typehints/row_type.py +++ b/sdks/python/apache_beam/typehints/row_type.py @@ -163,8 +163,7 @@ def __hash__(self): def __repr__(self): return 'Row(%s)' % ', '.join( - '%s=%s' % (name, typehints._unified_repr(t)) for name, - t in self._fields) + '%s=%s' % (name, repr(t)) for name, t in self._fields) def get_type_for(self, name): return dict(self._fields)[name] diff --git a/sdks/python/apache_beam/typehints/sharded_key_type.py b/sdks/python/apache_beam/typehints/sharded_key_type.py index 24611416d44b3..079ad48c2170f 100644 --- a/sdks/python/apache_beam/typehints/sharded_key_type.py +++ b/sdks/python/apache_beam/typehints/sharded_key_type.py @@ -61,10 +61,8 @@ def type_check(self, instance): raise typehints.CompositeTypeHintError( "%s type-constraint violated. The type of key in 'ShardedKey' " "is incorrect. Expected an instance of type '%s', " - "instead received an instance of type '%s'." % ( - repr(self), - typehints._unified_repr(self.key_type), - instance.key.__class__.__name__)) + "instead received an instance of type '%s'." % + (repr(self), repr(self.key_type), instance.key.__class__.__name__)) def match_type_variables(self, concrete_type): if isinstance(concrete_type, ShardedKeyTypeConstraint): @@ -80,7 +78,7 @@ def __hash__(self): return hash(self.key_type) def __repr__(self): - return 'ShardedKey[%s]' % typehints._unified_repr(self.key_type) + return 'ShardedKey[%s]' % repr(self.key_type) ShardedKeyType = ShardedKeyTypeConstraint diff --git a/sdks/python/apache_beam/typehints/sharded_key_type_test.py b/sdks/python/apache_beam/typehints/sharded_key_type_test.py index 922fcf96cc9e5..631b72bf0030e 100644 --- a/sdks/python/apache_beam/typehints/sharded_key_type_test.py +++ b/sdks/python/apache_beam/typehints/sharded_key_type_test.py @@ -37,7 +37,7 @@ def test_compatibility(self): def test_repr(self): constraint = ShardedKeyType[int] - self.assertEqual('ShardedKey[int]', repr(constraint)) + self.assertEqual('ShardedKey[]', repr(constraint)) def test_type_check_not_sharded_key(self): constraint = ShardedKeyType[int] @@ -55,9 +55,9 @@ def test_type_check_invalid_key_type(self): with self.assertRaises((TypeError, TypeError)) as e: constraint.type_check(obj) self.assertEqual( - "ShardedKey[int] type-constraint violated. The type of key in " - "'ShardedKey' is incorrect. Expected an instance of type 'int', " - "instead received an instance of type 'str'.", + "ShardedKey[] type-constraint violated. The type of key " + "in 'ShardedKey' is incorrect. Expected an instance of type \'\', instead received an instance of type 'str'.", e.exception.args[0]) def test_type_check_valid_simple_type(self): diff --git a/sdks/python/apache_beam/typehints/typecheck_test.py b/sdks/python/apache_beam/typehints/typecheck_test.py index b6897b55d4137..32307c5202e94 100644 --- a/sdks/python/apache_beam/typehints/typecheck_test.py +++ b/sdks/python/apache_beam/typehints/typecheck_test.py @@ -263,9 +263,9 @@ def is_even_as_key(a): e.exception.args[0], "Runtime type violation detected within ParDo(IsEven): " "Type-hint for return type violated: " - "Tuple[bool, int] hint type-constraint violated. " - "The type of element #0 in the passed tuple is incorrect. " - "Expected an instance of type bool, " + "Tuple[, ] hint type-constraint " + "violated. The type of element #0 in the passed tuple is incorrect. " + "Expected an instance of type , " "instead received an instance of type int. ") def test_pipeline_runtime_checking_violation_composite_type_output(self): diff --git a/sdks/python/apache_beam/typehints/typed_pipeline_test.py b/sdks/python/apache_beam/typehints/typed_pipeline_test.py index 8b20c9e82965f..9774a37ac88c3 100644 --- a/sdks/python/apache_beam/typehints/typed_pipeline_test.py +++ b/sdks/python/apache_beam/typehints/typed_pipeline_test.py @@ -126,12 +126,14 @@ def process(self, element: int) -> typehints.Tuple[str]: result = [(1, 2)] | beam.ParDo(MyDoFn()) self.assertEqual([1], sorted(result)) - with self.assertRaisesRegex(typehints.TypeCheckError, - r'requires.*Tuple\[int, int\].*got.*str'): + with self.assertRaisesRegex( + typehints.TypeCheckError, + r'requires.*Tuple\[, \].*got.*str'): _ = ['a', 'b', 'c'] | beam.ParDo(MyDoFn()) - with self.assertRaisesRegex(typehints.TypeCheckError, - r'requires.*Tuple\[int, int\].*got.*int'): + with self.assertRaisesRegex( + typehints.TypeCheckError, + r'requires.*Tuple\[, \].*got.*int'): _ = [1, 2, 3] | (beam.ParDo(MyDoFn()) | 'again' >> beam.ParDo(MyDoFn())) def test_typed_callable_iterable_output(self): @@ -745,7 +747,8 @@ def repeat(s, *times): with self.assertRaisesRegex( typehints.TypeCheckError, - r'requires Tuple\[int, ...\] but got Tuple\[str, ...\]'): + (r'requires Tuple\[, ...\] but got ' + r'Tuple\[, ...\]')): ['a', 'bb', 'c'] | beam.Map(repeat, 'z') def test_var_positional_only_side_input_hint(self): @@ -762,8 +765,8 @@ def test_var_positional_only_side_input_hint(self): with self.assertRaisesRegex( typehints.TypeCheckError, - r'requires Tuple\[Union\[int, str\], ...\] but got ' - r'Tuple\[Union\[float, int\], ...\]'): + r'requires Tuple\[Union\[, \], ...\] but ' + r'got Tuple\[Union\[, \], ...\]'): _ = [1.2] | beam.Map(lambda *_: 'a', 5).with_input_types(int, str) def test_var_keyword_side_input_hint(self): @@ -783,7 +786,8 @@ def test_var_keyword_side_input_hint(self): with self.assertRaisesRegex( typehints.TypeCheckError, - r'requires Dict\[str, str\] but got Dict\[str, int\]'): + r'requires Dict\[, \] but got ' + r'Dict\[, \]'): _ = (['a', 'b', 'c'] | beam.Map(lambda e, **_: 'a', kw=5).with_input_types( str, ignored=str)) diff --git a/sdks/python/apache_beam/typehints/typehints.py b/sdks/python/apache_beam/typehints/typehints.py index e22e2760b46be..1695ac2bf7b24 100644 --- a/sdks/python/apache_beam/typehints/typehints.py +++ b/sdks/python/apache_beam/typehints/typehints.py @@ -287,8 +287,8 @@ def type_check(self, sequence_instance): 'instead received an instance of type %s.' % ( repr(self), index, - _unified_repr(self._sequence_type), - _unified_repr(self.inner_type), + repr(self._sequence_type), + repr(self.inner_type), elem.__class__.__name__)) except CompositeTypeHintError as e: raise CompositeTypeHintError( @@ -394,27 +394,6 @@ def validate_composite_type_param(type_param, error_msg_prefix): (error_msg_prefix, type_param, type_param.__class__.__name__)) -# TODO(https://github.com/apache/beam/issues/20982): Remove this function and -# use plain repr() instead. -def _unified_repr(o): - """Given an object return a qualified name for the object. - - This function closely mirrors '__qualname__' which was introduced in - Python 3.3. It is used primarily to format types or object instances for - error messages. - - Args: - o: An instance of a TypeConstraint or a type. - - Returns: - A qualified name for the passed Python object fit for string formatting. - """ - if isinstance(o, (TypeConstraint, type(None))) or not hasattr(o, '__name__'): - return repr(o) - else: - return o.__name__ - - def check_constraint(type_constraint, object_instance): """Determine if the passed type instance satisfies the TypeConstraint. @@ -533,7 +512,7 @@ def __hash__(self): def __repr__(self): # Sorting the type name strings simplifies unit tests. return 'Union[%s]' % ( - ', '.join(sorted(_unified_repr(t) for t in self.union_types))) + ', '.join(sorted(repr(t) for t in self.union_types))) def inner_types(self): for t in self.union_types: @@ -565,7 +544,7 @@ def type_check(self, instance): '%s type-constraint violated. Expected an instance of one of: %s, ' 'received %s instead.%s' % ( repr(self), - tuple(sorted(_unified_repr(t) for t in self.union_types)), + tuple(sorted(repr(t) for t in self.union_types)), instance.__class__.__name__, error_msg)) @@ -673,7 +652,7 @@ def __init__(self, type_param): super().__init__(type_param, tuple) def __repr__(self): - return 'Tuple[%s, ...]' % _unified_repr(self.inner_type) + return 'Tuple[%s, ...]' % repr(self.inner_type) def _consistent_with_check_(self, sub): if isinstance(sub, TupleConstraint): @@ -696,8 +675,7 @@ def __hash__(self): return hash(self.tuple_types) def __repr__(self): - return 'Tuple[%s]' % ( - ', '.join(_unified_repr(t) for t in self.tuple_types)) + return 'Tuple[%s]' % (', '.join(repr(t) for t in self.tuple_types)) def _inner_types(self): for t in self.tuple_types: @@ -737,11 +715,8 @@ def type_check(self, tuple_instance): raise CompositeTypeHintError( '%s hint type-constraint violated. The type of element #%s in ' 'the passed tuple is incorrect. Expected an instance of ' - 'type %s, instead received an instance of type %s.' % ( - repr(self), - type_pos, - _unified_repr(expected), - actual.__class__.__name__)) + 'type %s, instead received an instance of type %s.' % + (repr(self), type_pos, repr(expected), actual.__class__.__name__)) except CompositeTypeHintError as e: raise CompositeTypeHintError( '%s hint type-constraint violated. The type of element #%s in ' @@ -805,7 +780,7 @@ def __init__(self, list_type): super().__init__(list_type, list) def __repr__(self): - return 'List[%s]' % _unified_repr(self.inner_type) + return 'List[%s]' % repr(self.inner_type) def __getitem__(self, t): validate_composite_type_param(t, error_msg_prefix='Parameter to List hint') @@ -864,8 +839,7 @@ def __init__(self, key_type, value_type): self.value_type = normalize(value_type) def __repr__(self): - return 'Dict[%s, %s]' % ( - _unified_repr(self.key_type), _unified_repr(self.value_type)) + return 'Dict[%s, %s]' % (repr(self.key_type), repr(self.value_type)) def __eq__(self, other): return ( @@ -896,7 +870,7 @@ def _raise_hint_exception_or_inner_exception( repr(self), incorrect_type[:-1], incorrect_type, - _unified_repr(hinted_type), + repr(hinted_type), inner_error_message)) else: raise CompositeTypeHintError( @@ -905,7 +879,7 @@ def _raise_hint_exception_or_inner_exception( repr(self), incorrect_type[:-1], incorrect_type, - _unified_repr(hinted_type), + repr(hinted_type), incorrect_instance, incorrect_instance.__class__.__name__)) @@ -986,7 +960,7 @@ def __init__(self, type_param): super().__init__(type_param, set) def __repr__(self): - return 'Set[%s]' % _unified_repr(self.inner_type) + return 'Set[%s]' % repr(self.inner_type) def __getitem__(self, type_param): validate_composite_type_param( @@ -1012,7 +986,7 @@ def __init__(self, type_param): self).__init__(type_param, frozenset) def __repr__(self): - return 'FrozenSet[%s]' % _unified_repr(self.inner_type) + return 'FrozenSet[%s]' % repr(self.inner_type) def __getitem__(self, type_param): validate_composite_type_param( @@ -1036,7 +1010,7 @@ def __init__(self, iter_type): self).__init__(iter_type, abc.Iterable) def __repr__(self): - return 'Iterable[%s]' % _unified_repr(self.inner_type) + return 'Iterable[%s]' % repr(self.inner_type) def _consistent_with_check_(self, sub): if isinstance(sub, SequenceTypeConstraint): @@ -1077,7 +1051,7 @@ def __init__(self, t): self.yielded_type = normalize(t) def __repr__(self): - return 'Iterator[%s]' % _unified_repr(self.yielded_type) + return 'Iterator[%s]' % repr(self.yielded_type) def __eq__(self, other): return ( @@ -1106,10 +1080,8 @@ def type_check(self, instance): except SimpleTypeHintError: raise CompositeTypeHintError( '%s hint type-constraint violated. Expected a iterator of type %s. ' - 'Instead received a iterator of type %s.' % ( - repr(self), - _unified_repr(self.yielded_type), - instance.__class__.__name__)) + 'Instead received a iterator of type %s.' % + (repr(self), repr(self.yielded_type), instance.__class__.__name__)) def __getitem__(self, type_param): validate_composite_type_param( @@ -1164,7 +1136,7 @@ def type_check(self, instance): 'is incorrect. Expected an instance of type %s, ' 'instead received an instance of type %s.' % ( repr(self), - _unified_repr(self.inner_type), + repr(self.inner_type), instance.value.__class__.__name__)) diff --git a/sdks/python/apache_beam/typehints/typehints_test.py b/sdks/python/apache_beam/typehints/typehints_test.py index 9898ca67a4477..1c91902825d30 100644 --- a/sdks/python/apache_beam/typehints/typehints_test.py +++ b/sdks/python/apache_beam/typehints/typehints_test.py @@ -235,7 +235,12 @@ def test_union_hint_repr(self): self.assertIn( str(hint), # Uses frozen set internally, so order not guaranteed. - ['Union[str, DummyTestClass1]', 'Union[DummyTestClass1, str]']) + [ + "Union[, ]", + "Union[, ]" + ]) def test_union_hint_enforcement_composite_type_in_union(self): o = DummyTestClass1() @@ -255,9 +260,9 @@ def test_union_hint_enforcement_not_part_of_union(self): hint.type_check('test') self.assertEqual( - "Union[float, int] type-constraint violated. Expected an " - "instance of one of: ('float', 'int'), received str " - "instead.", + "Union[, ] type-constraint violated. " + "Expected an instance of one of: (\"\", \"\"), received str instead.", e.exception.args[0]) def test_dict_union(self): @@ -405,13 +410,18 @@ def test_raw_tuple(self): def test_repr(self): hint = typehints.Tuple[int, str, float] - self.assertEqual('Tuple[int, str, float]', str(hint)) + self.assertEqual( + 'Tuple[, , ]', str(hint)) hint = typehints.Tuple[DummyTestClass1, DummyTestClass2] - self.assertEqual('Tuple[DummyTestClass1, DummyTestClass2]', str(hint)) + self.assertEqual( + 'Tuple[, ]', + str(hint)) hint = typehints.Tuple[float, ...] - self.assertEqual('Tuple[float, ...]', str(hint)) + self.assertEqual('Tuple[, ...]', str(hint)) def test_type_check_must_be_tuple(self): hint = typehints.Tuple[int, str] @@ -440,9 +450,9 @@ def test_type_check_invalid_simple_types(self): with self.assertRaises(TypeError) as e: hint.type_check((4, False)) self.assertEqual( - 'Tuple[str, bool] hint type-constraint violated. The ' - 'type of element #0 in the passed tuple is incorrect.' - ' Expected an instance of type str, instead received ' + 'Tuple[, ] hint type-constraint ' + 'violated. The type of element #0 in the passed tuple is incorrect.' + ' Expected an instance of type , instead received ' 'an instance of type int.', e.exception.args[0]) @@ -453,10 +463,12 @@ def test_type_check_invalid_composite_type(self): hint.type_check(t) self.assertEqual( - 'Tuple[DummyTestClass1, DummyTestClass2] hint ' - 'type-constraint violated. The type of element #0 in the ' + 'Tuple[, ]' + ' hint type-constraint violated. The type of element #0 in the ' 'passed tuple is incorrect. Expected an instance of type ' - 'DummyTestClass1, instead received an instance of type ' + ', ' + 'instead received an instance of type ' 'DummyTestClass2.', e.exception.args[0]) @@ -490,9 +502,9 @@ def test_type_check_invalid_simple_type_arbitrary_length(self): hint.type_check(t) self.assertEqual( - 'Tuple[str, ...] hint type-constraint violated. The type ' - 'of element #2 in the passed tuple is incorrect. Expected ' - 'an instance of type str, instead received an instance of ' + 'Tuple[, ...] hint type-constraint violated. The type ' + 'of element #2 in the passed is incorrect. Expected ' + 'an instance of type , instead received an instance of ' 'type int.', e.exception.args[0]) @@ -504,7 +516,7 @@ def test_type_check_invalid_composite_type_arbitrary_length(self): hint.type_check(t) self.assertEqual( - "Tuple[List[int], ...] hint type-constraint violated. The " + "Tuple[List[], ...] hint type-constraint violated. The " "type of element #1 in the passed tuple is incorrect: " "List type-constraint violated. Valid object instance " "must be of type 'list'. Instead, an instance of 'str' " @@ -529,7 +541,10 @@ def test_list_constraint_compatibility(self): def test_list_repr(self): hint = (typehints.List[typehints.Tuple[DummyTestClass1, DummyTestClass2]]) self.assertEqual( - 'List[Tuple[DummyTestClass1, DummyTestClass2]]', repr(hint)) + 'List[Tuple[, ]]', + repr(hint)) def test_enforce_list_type_constraint_valid_simple_type(self): hint = typehints.List[int] @@ -546,9 +561,9 @@ def test_enforce_list_type_constraint_invalid_simple_type(self): with self.assertRaises(TypeError) as e: hint.type_check(l) self.assertEqual( - 'List[int] hint type-constraint violated. The type of ' - 'element #0 in the passed list is incorrect. Expected an ' - 'instance of type int, instead received an instance of ' + 'List[] hint type-constraint violated. The type of ' + 'element #0 in the passed is incorrect. Expected an ' + 'instance of type , instead received an instance of ' 'type str.', e.exception.args[0]) @@ -559,11 +574,11 @@ def test_enforce_list_type_constraint_invalid_composite_type(self): hint.type_check(l) self.assertEqual( - 'List[Tuple[int, int]] hint type-constraint violated.' - ' The type of element #0 in the passed list is ' - 'incorrect: Tuple[int, int] hint type-constraint ' - 'violated. The type of element #0 in the passed tuple' - ' is incorrect. Expected an instance of type int, ' + 'List[Tuple[, ]] hint type-constraint ' + 'violated. The type of element #0 in the passed list is ' + 'incorrect: Tuple[, ] hint ' + 'type-constraint violated. The type of element #0 in the passed tuple' + ' is incorrect. Expected an instance of type , ' 'instead received an instance of type str.', e.exception.args[0]) @@ -640,7 +655,10 @@ def test_compatibility(self): def test_repr(self): hint3 = typehints.Dict[int, typehints.List[typehints.Tuple[str, str, str]]] - self.assertEqual('Dict[int, List[Tuple[str, str, str]]]', repr(hint3)) + self.assertEqual( + 'Dict[, List[Tuple[, ' \ + ', ]]]', + repr(hint3)) def test_type_checks_not_dict(self): hint = typehints.Dict[int, str] @@ -658,10 +676,11 @@ def test_type_check_invalid_key_type(self): with self.assertRaises((TypeError, TypeError)) as e: hint.type_check(d) self.assertEqual( - 'Dict[Tuple[int, int, int], List[str]] hint key-type ' + 'Dict[Tuple[, , ], ' + 'List[]] hint key-type ' 'constraint violated. All keys should be of type ' - 'Tuple[int, int, int]. Instead: Passed object ' - 'instance is of the proper type, but differs in ' + 'Tuple[, , ]. Instead: ' + 'Passed object instance is of the proper type, but differs in ' 'length from the hinted type. Expected a tuple of ' 'length 3, received a tuple of length 2.', e.exception.args[0]) @@ -672,9 +691,9 @@ def test_type_check_invalid_value_type(self): with self.assertRaises(TypeError) as e: hint.type_check(d) self.assertEqual( - 'Dict[str, Dict[int, str]] hint value-type constraint' - ' violated. All values should be of type ' - 'Dict[int, str]. Instead: Dict type-constraint ' + 'Dict[, Dict[, ]] hint ' + 'value-type constraint violated. All values should be of type ' + 'Dict[, ]. Instead: Dict type-constraint ' 'violated. All passed instances must be of type dict.' ' [1, 2, 3] is of type list.', e.exception.args[0]) @@ -719,7 +738,8 @@ def test_compatibility(self): def test_repr(self): hint = self.beam_type[typehints.List[bool]] - self.assertEqual('{}[List[bool]]'.format(self.string_type), repr(hint)) + self.assertEqual( + '{}[List[]]'.format(self.string_type), repr(hint)) def test_type_check_must_be_set(self): hint = self.beam_type[str] @@ -806,7 +826,7 @@ def test_tuple_compatibility(self): def test_repr(self): hint = typehints.Iterable[typehints.Set[str]] - self.assertEqual('Iterable[Set[str]]', repr(hint)) + self.assertEqual('Iterable[Set[]]', repr(hint)) def test_type_check_must_be_iterable(self): with self.assertRaises(TypeError) as e: @@ -863,7 +883,7 @@ def count(n): class GeneratorHintTestCase(TypeHintTestCase): def test_repr(self): hint = typehints.Iterator[typehints.Set[str]] - self.assertEqual('Iterator[Set[str]]', repr(hint)) + self.assertEqual('Iterator[Set[]]', repr(hint)) def test_compatibility(self): self.assertCompatible(typehints.Iterator[int], typehints.Iterator[int]) @@ -885,9 +905,9 @@ def all_upper(s): next(all_upper('hello')) self.assertEqual( - 'Type-hint for return type violated: Iterator[int] ' + 'Type-hint for return type violated: Iterator[] ' 'hint type-constraint violated. Expected a iterator ' - 'of type int. Instead received a iterator of type ' + 'of type . Instead received a iterator of type ' 'str.', e.exception.args[0]) @@ -905,9 +925,9 @@ def increment(a): increment(wrong_yield_gen()) self.assertEqual( - "Type-hint for argument: 'a' violated: Iterator[int] " + "Type-hint for argument: 'a' violated: Iterator[] " "hint type-constraint violated. Expected a iterator " - "of type int. Instead received a iterator of type " + "of type . Instead received a iterator of type " "str.", e.exception.args[0]) @@ -966,7 +986,7 @@ def foo(a): m = ['f', 'f'] foo(m) self.assertEqual( - "Type-hint for argument: 'a' violated: List[int] hint " + "Type-hint for argument: 'a' violated: List[] hint " "type-constraint violated. The type of element #0 in " "the passed list is incorrect. Expected an instance of " "type int, instead received an instance of type str.", @@ -1304,14 +1324,14 @@ def test_getcallargs_forhints_builtins(self): }, getcallargs_forhints(str.join, str, typehints.List[int])) - def test_unified_repr(self): - self.assertIn('int', typehints._unified_repr(int)) - self.assertIn('PCollection', typehints._unified_repr(PCollection)) - if sys.version_info < (3, 7): - self.assertIn('PCollection', typehints._unified_repr(PCollection[int])) - else: - self.assertIn( - 'PCollection[int]', typehints._unified_repr(PCollection[int])) + # def test_unified_repr(self): + # self.assertIn('int', typehints._unified_repr(int)) + # self.assertIn('PCollection', typehints._unified_repr(PCollection)) + # if sys.version_info < (3, 7): + # self.assertIn('PCollection', typehints._unified_repr(PCollection[int])) + # else: + # self.assertIn( + # 'PCollection[int]', typehints._unified_repr(PCollection[int])) class TestGetYieldedType(unittest.TestCase):