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

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

                Author: ASF GitHub Bot
            Created on: 05/Aug/19 23:47
            Start Date: 05/Aug/19 23:47
    Worklog Time Spent: 10m 
      Work Description: davidcavazos commented on pull request #9257: 
[BEAM-7389] Add DoFn methods sample
URL: https://github.com/apache/beam/pull/9257#discussion_r310833381
 
 

 ##########
 File path: 
sdks/python/apache_beam/examples/snippets/transforms/element_wise/pardo_test.py
 ##########
 @@ -58,24 +58,44 @@ def check_dofn_params(actual):
 type(window) -> <class 'apache_beam.transforms.window.IntervalWindow'>
 window.start -> Timestamp(1584675660) (2020-03-20 03:41:00)
 window.end -> Timestamp(1584675690) (2020-03-20 03:41:30)
-window.max_timestamp() -> Timestamp(1584675689.999999) (2020-03-20 
03:41:29.999999)'''
-  # [END dofn_params]
+window.max_timestamp() -> Timestamp(1584675689.999999) (2020-03-20 
03:41:29.999999)
+[END dofn_params]'''.splitlines()[1:-1])
   # pylint: enable=line-too-long
   assert_that(actual, equal_to([dofn_params]))
 
 
+def check_dofn_methods(actual):
+  results = '''[START results]
+__init__
+setup
+start_bundle
+* process: 🍓
+* process: 🥕
+* process: 🍆
+* process: 🍅
+* process: 🥔
+* finish_bundle: 🌱🌳🌍
+teardown
+[END results]'''.splitlines()[1:-1]
+  results = [line for line in results if line.startswith('*')]
+  assert_that(actual, equal_to(results))
 
 Review comment:
   Good point. The sample code prints that as an output, and it makes sense to 
see what gets called after what. However, for the test we're only testing for 
the elements produced by `process` and `finish_bundle` since those are the ones 
that affect the output `PCollection`. So that's why I marked them with a `*` to 
make them easier to spot and test for. I'm adding a comment for this.
 
----------------------------------------------------------------
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: 289266)
    Time Spent: 32h 20m  (was: 32h 10m)

> Colab examples for element-wise transforms (Python)
> ---------------------------------------------------
>
>                 Key: BEAM-7389
>                 URL: https://issues.apache.org/jira/browse/BEAM-7389
>             Project: Beam
>          Issue Type: Improvement
>          Components: website
>            Reporter: Rose Nguyen
>            Assignee: David Cavazos
>            Priority: Minor
>          Time Spent: 32h 20m
>  Remaining Estimate: 0h
>




--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

Reply via email to