Skip to content

Commit

Permalink
Update failing unit test to use str instead of int
Browse files Browse the repository at this point in the history
  • Loading branch information
hjtran authored and reeba212 committed Dec 4, 2024
1 parent a9a45c2 commit 4c9c5ce
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions sdks/python/apache_beam/transforms/ptransform_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1495,17 +1495,17 @@ def test_filter_does_not_type_check_using_type_hints_decorator(self):
def more_than_half(a):
return a > 0.50

# Func above was hinted to only take a float, yet an int will be passed.
# Func above was hinted to only take a float, yet a str will be passed.
with self.assertRaises(typehints.TypeCheckError) as e:
(
self.p
| 'Ints' >> beam.Create([1, 2, 3, 4]).with_output_types(int)
| 'Ints' >> beam.Create(['1', '2', '3', '4']).with_output_types(str)
| 'Half' >> beam.Filter(more_than_half))

self.assertStartswith(
e.exception.args[0],
"Type hint violation for 'Half': "
"requires {} but got {} for a".format(float, int))
"requires {} but got {} for a".format(float, str))

def test_filter_type_checks_using_type_hints_decorator(self):
@with_input_types(b=int)
Expand Down

0 comments on commit 4c9c5ce

Please sign in to comment.