Skip to content

Commit d261aa1

Browse files
committed
Fix pylint and RunInference singleton test
1 parent 8be7201 commit d261aa1

2 files changed

Lines changed: 8 additions & 9 deletions

File tree

sdks/python/apache_beam/examples/inference/table_row_inference_test.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@
3636
from apache_beam.testing.test_pipeline import TestPipeline
3737
from apache_beam.testing.util import assert_that
3838

39-
# Module-level matcher for assert_that (must be picklable; no closure over self).
39+
# Module-level matcher for assert_that (must be picklable; no closure over
40+
# self).
4041
REQUIRED_OUTPUT_KEYS = (
4142
'row_key',
4243
'prediction',

sdks/python/apache_beam/ml/inference/base_test.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1155,10 +1155,9 @@ def test_run_inference_with_iterable_side_input(self):
11551155
FakeModelHandler(), model_metadata_pcoll=side_input))
11561156
test_pipeline.run()
11571157

1158-
self.assertTrue(
1159-
'PCollection of size 2 with more than one element accessed as a '
1160-
'singleton view. First two elements encountered are' in str(
1161-
e.exception))
1158+
msg = str(e.exception)
1159+
self.assertIn('singleton', msg, msg='Expected singleton view error')
1160+
self.assertIn('more than one', msg, msg='Expected multiple-elements error')
11621161

11631162
def test_run_inference_with_iterable_side_input_multi_process_shared(self):
11641163
test_pipeline = TestPipeline()
@@ -1180,10 +1179,9 @@ def test_run_inference_with_iterable_side_input_multi_process_shared(self):
11801179
model_metadata_pcoll=side_input))
11811180
test_pipeline.run()
11821181

1183-
self.assertTrue(
1184-
'PCollection of size 2 with more than one element accessed as a '
1185-
'singleton view. First two elements encountered are' in str(
1186-
e.exception))
1182+
msg = str(e.exception)
1183+
self.assertIn('singleton', msg, msg='Expected singleton view error')
1184+
self.assertIn('more than one', msg, msg='Expected multiple-elements error')
11871185

11881186
def test_run_inference_empty_side_input(self):
11891187
model_handler = FakeModelHandlerReturnsPredictionResult()

0 commit comments

Comments
 (0)