[ 
https://issues.apache.org/jira/browse/BEAM-8575?focusedWorklogId=359118&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-359118
 ]

ASF GitHub Bot logged work on BEAM-8575:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 13/Dec/19 03:33
            Start Date: 13/Dec/19 03:33
    Worklog Time Spent: 10m 
      Work Description: bumblebee-coming commented on pull request #10190: 
[BEAM-8575] Added two unit tests to CombineTest class to test that Co…
URL: https://github.com/apache/beam/pull/10190#discussion_r357473023
 
 

 ##########
 File path: sdks/python/apache_beam/transforms/combiners_test.py
 ##########
 @@ -48,6 +50,37 @@
 from apache_beam.utils.timestamp import Timestamp
 
 
+class CounterIncrememtingCombineFn(beam.CombineFn):
+  """CombineFn for incrementing three different counters:
+     counter, distribution, gauge,
+     at the same time concatenating words."""
+
+  def __init__(self):
+    beam.CombineFn.__init__(self)
+    self.word_counter = Metrics.counter(self.__class__, 'word_counter')
+    self.word_lengths_counter = Metrics.counter(
+        self.__class__, 'word_lengths')
+    self.word_lengths_dist = Metrics.distribution(
+        self.__class__, 'word_len_dist')
+    self.last_word_len = Metrics.gauge(self.__class__, 'last_word_len')
+
+  def create_accumulator(self):
+    return ''
+
+  def add_input(self, acc, element):
+    self.word_counter.inc(1)
+    self.word_lengths_counter.inc(len(element))
+    self.word_lengths_dist.update(len(element))
+    self.last_word_len.set(len(element))
+    return acc + element
 
 Review comment:
   Done.
 
----------------------------------------------------------------
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: 359118)
    Time Spent: 34h 20m  (was: 34h 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: 34h 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)

Reply via email to