You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@beam.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2019/11/07 01:07:00 UTC

[jira] [Work logged] (BEAM-8575) Add more Python validates runner tests

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

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

                Author: ASF GitHub Bot
            Created on: 07/Nov/19 01:06
            Start Date: 07/Nov/19 01:06
    Worklog Time Spent: 10m 
      Work Description: liumomo315 commented on pull request #9957: [BEAM-8575] Add validates runner tests for 1. Custom window fn: Test a customized window fn work as expected; 2. Windows idempotency: Applying the same window fn (or window fn + GBK) to the input multiple times will have the same effect as applying it once.
URL: https://github.com/apache/beam/pull/9957#discussion_r343407270
 
 

 ##########
 File path: sdks/python/apache_beam/transforms/window_test.py
 ##########
 @@ -252,6 +276,50 @@ def test_timestamped_with_combiners(self):
       assert_that(mean_per_window, equal_to([(0, 2.0), (1, 7.0)]),
                   label='assert:mean')
 
+  @attr('ValidatesRunner')
+  def test_custom_windows(self):
+    with TestPipeline() as p:
+      result = (p | Create([TimestampedValue(x, x * 100) for x in range(7)])
+                | 'custom window' >> WindowInto(TestCustomWindows(250, 200))
+                | 'insert key' >> Map(lambda v: ('key', v.value))
+                | GroupByKey())
+
+      assert_that(result, equal_to([('key', [0, 1, 2]),
+                                    ('key', [3, 4]),
+                                    ('key', [5]),
+                                    ('key', [6])]))
+
+  @attr('ValidatesRunner')
+  def test_windows_idempotency(self):
+    with TestPipeline() as p:
+      result = (p | Create([(x, x * 2) for x in range(5)])
+                | Map(lambda item: TimestampedValue(item[0], item[1]))
+                | Map(lambda v: ('key', v))
+                | 'window' >> WindowInto(FixedWindows(4))
+                | 'same window' >> WindowInto(FixedWindows(4))
+                | 'same window again' >> WindowInto(FixedWindows(4))
+                | GroupByKey())
+
+      assert_that(result, equal_to([('key', [0, 1]),
+                                    ('key', [2, 3]),
+                                    ('key', [4])]))
+
+  @attr('ValidatesRunner')
+  def test_windows_gbk_idempotency(self):
+    with TestPipeline() as p:
+      result = (p | Create([(x, x * 2) for x in range(5)])
 
 Review comment:
   Same for this one:)
 
----------------------------------------------------------------
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:
users@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 339663)
    Time Spent: 20m  (was: 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
>            Priority: Major
>          Time Spent: 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)