|
40 | 40 | from apache_beam.typehints import row_type |
41 | 41 | from apache_beam.typehints import typehints |
42 | 42 |
|
43 | | -RETURN_NONE_PARTIAL_WARNING = "No iterator is returned" |
| 43 | +RETURN_NONE_PARTIAL_WARNING = "Process method returned None" |
44 | 44 |
|
45 | 45 |
|
46 | 46 | class TestDoFn1(beam.DoFn): |
@@ -121,9 +121,11 @@ def process(self, element): |
121 | 121 |
|
122 | 122 |
|
123 | 123 | class TestDoFn12(beam.DoFn): |
124 | | - """test process returning None (return statement without a value)""" |
| 124 | + """test process returning None in a filter pattern""" |
125 | 125 | def process(self, element): |
126 | | - return |
| 126 | + if element == 0: |
| 127 | + return |
| 128 | + return element |
127 | 129 |
|
128 | 130 |
|
129 | 131 | class TestDoFnStateful(beam.DoFn): |
@@ -194,14 +196,12 @@ def test_dofn_with_explicit_return_none(self): |
194 | 196 | def test_dofn_with_implicit_return_none_missing_return_and_yield(self): |
195 | 197 | with self._caplog.at_level(logging.WARNING): |
196 | 198 | beam.ParDo(TestDoFn11()) |
197 | | - assert RETURN_NONE_PARTIAL_WARNING in self._caplog.text |
198 | | - assert str(TestDoFn11) in self._caplog.text |
| 199 | + assert RETURN_NONE_PARTIAL_WARNING not in self._caplog.text |
199 | 200 |
|
200 | | - def test_dofn_with_implicit_return_none_return_without_value(self): |
| 201 | + def test_dofn_with_implicit_return_none_and_value(self): |
201 | 202 | with self._caplog.at_level(logging.WARNING): |
202 | 203 | beam.ParDo(TestDoFn12()) |
203 | | - assert RETURN_NONE_PARTIAL_WARNING in self._caplog.text |
204 | | - assert str(TestDoFn12) in self._caplog.text |
| 204 | + assert RETURN_NONE_PARTIAL_WARNING not in self._caplog.text |
205 | 205 |
|
206 | 206 |
|
207 | 207 | class PartitionTest(unittest.TestCase): |
|
0 commit comments