KevinGG commented on code in PR #17351:
URL: https://github.com/apache/beam/pull/17351#discussion_r848918025
##########
sdks/python/apache_beam/runners/interactive/sql/utils_test.py:
##########
@@ -76,17 +76,23 @@ def test_replace_single_pcoll_token(self):
replaced_sql, 'SELECT * FROM PCOLLECTION WHERE a=1 AND b=2')
def test_pformat_namedtuple(self):
- self.assertEqual(
- 'ANamedTuple(a: int, b: str)', pformat_namedtuple(ANamedTuple))
+ expected = pformat_namedtuple(ANamedTuple)
+ self.assertIn('ANamedTuple(', expected)
+ self.assertIn('a: int', expected)
+ self.assertIn('b: str', expected)
- @unittest.skip("BEAM-14288")
def test_pformat_namedtuple_with_unnamed_fields(self):
- self.assertEqual(
- f'OptionalUnionType(unnamed: {repr(Optional[Union[int, str]])})',
- pformat_namedtuple(OptionalUnionType))
+ expected = pformat_namedtuple(OptionalUnionType)
+ self.assertIn('OptionalUnionType(unnamed: ', expected)
+ self.assertIn('Union', expected)
+ self.assertIn('int', expected)
+ self.assertIn('str', expected)
+ self.assertIn('NoneType', expected)
Review Comment:
I think it's fine for these functions since they just pretty print stuff. I
could also enumerate all possible combinations of the parameters and then
assertIn those.
Sending a commit to reverse test changes for dict and use enumerated values
for asserting non-deterministic formatting.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]