[ https://issues.apache.org/jira/browse/BEAM-8575?focusedWorklogId=361043&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-361043 ]
ASF GitHub Bot logged work on BEAM-8575: ---------------------------------------- Author: ASF GitHub Bot Created on: 17/Dec/19 18:35 Start Date: 17/Dec/19 18:35 Worklog Time Spent: 10m Work Description: bumblebee-coming commented on pull request #10159: [BEAM-8575] Added a unit test to CombineTest class to test that Combiā¦ URL: https://github.com/apache/beam/pull/10159#discussion_r358958960 ########## File path: sdks/python/apache_beam/transforms/combiners_test.py ########## @@ -399,6 +418,43 @@ def test_global_fanout(self): | beam.CombineGlobally(combine.MeanCombineFn()).with_fanout(11)) assert_that(result, equal_to([49.5])) + def test_combining_with_accumulation_mode(self): + # PCollection will contain elements from 1 to 5. + elements = [i for i in range(1, 6)] + + ts = TestStream().advance_watermark_to(0) + for i in elements: + ts.add_elements([i]) + ts.advance_watermark_to_infinity() + + options = PipelineOptions() + options.view_as(StandardOptions).streaming = True + with TestPipeline(options=options) as p: + result = (p + | ts + | beam.WindowInto( + GlobalWindows(), + accumulation_mode=trigger.AccumulationMode.ACCUMULATING, + trigger=AfterWatermark(early=AfterAll(AfterCount(1))) + ) + | beam.CombineGlobally(sum).without_defaults().with_fanout(2) + | beam.ParDo(self.record_dofn())) + + # The trigger should fire repeatedly for each newly added element, + # and at least once for advancing the watermark to infinity. + # The firings should accumulate the output. + # First firing: 1 = 1 + # Second firing: 3 = 1 + 2 + # Third firing: 6 = 1 + 2 + 3 + # Fourth firing: 10 = 1 + 2 + 3 + 4 + # Fifth firing: 15 = 1 + 2 + 3 + 4 + 5 + # Next firings: 15 = 15 + 0 (advancing the watermark to infinity) + # The exact number of firings may vary, Review comment: No need to record firings anymore. The result is already a list of firings. See comments above. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking ------------------- Worklog Id: (was: 361043) Time Spent: 37h 20m (was: 37h 10m) > Add more Python validates runner tests > -------------------------------------- > > Key: BEAM-8575 > URL: https://issues.apache.org/jira/browse/BEAM-8575 > Project: Beam > Issue Type: Test > Components: sdk-py-core, testing > Reporter: wendy liu > Assignee: wendy liu > Priority: Major > Time Spent: 37h 20m > Remaining Estimate: 0h > > This is the umbrella issue to track the work of adding more Python tests to > improve test coverage. -- This message was sent by Atlassian Jira (v8.3.4#803005)