[
https://issues.apache.org/jira/browse/BEAM-7389?focusedWorklogId=328693&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-328693
]
ASF GitHub Bot logged work on BEAM-7389:
----------------------------------------
Author: ASF GitHub Bot
Created on: 15/Oct/19 17:29
Start Date: 15/Oct/19 17:29
Worklog Time Spent: 10m
Work Description: davidcavazos commented on pull request #9790:
[BEAM-7389] Show code snippet outputs as stdout
URL: https://github.com/apache/beam/pull/9790#discussion_r335083095
##########
File path:
sdks/python/apache_beam/examples/snippets/transforms/elementwise/filter_test.py
##########
@@ -31,31 +31,26 @@
def check_perennials(actual):
- # [START perennials]
- perennials = [
- {'icon': '🍓', 'name': 'Strawberry', 'duration': 'perennial'},
- {'icon': '🍆', 'name': 'Eggplant', 'duration': 'perennial'},
- {'icon': '🥔', 'name': 'Potato', 'duration': 'perennial'},
- ]
- # [END perennials]
- assert_that(actual, equal_to(perennials))
+ expected = '''[START perennials]
+{'icon': '🍓', 'name': 'Strawberry', 'duration': 'perennial'}
+{'icon': '🍆', 'name': 'Eggplant', 'duration': 'perennial'}
+{'icon': '🥔', 'name': 'Potato', 'duration': 'perennial'}
+[END perennials]'''.splitlines()[1:-1]
+ assert_that(actual, equal_to(expected))
def check_valid_plants(actual):
- # [START valid_plants]
- valid_plants = [
- {'icon': '🍓', 'name': 'Strawberry', 'duration': 'perennial'},
- {'icon': '🥕', 'name': 'Carrot', 'duration': 'biennial'},
- {'icon': '🍆', 'name': 'Eggplant', 'duration': 'perennial'},
- {'icon': '🍅', 'name': 'Tomato', 'duration': 'annual'},
- ]
- # [END valid_plants]
- assert_that(actual, equal_to(valid_plants))
+ expected = '''[START valid_plants]
+{'icon': '🍓', 'name': 'Strawberry', 'duration': 'perennial'}
+{'icon': '🥕', 'name': 'Carrot', 'duration': 'biennial'}
+{'icon': '🍆', 'name': 'Eggplant', 'duration': 'perennial'}
+{'icon': '🍅', 'name': 'Tomato', 'duration': 'annual'}
+[END valid_plants]'''.splitlines()[1:-1]
+ assert_that(actual, equal_to(expected))
@mock.patch('apache_beam.Pipeline', TestPipeline)
-# pylint: disable=line-too-long
[email protected]('apache_beam.examples.snippets.transforms.elementwise.filter.print',
lambda elem: elem)
[email protected]('apache_beam.examples.snippets.transforms.elementwise.filter.print',
str)
Review comment:
Some mock.patch lines could be broken into multiple lines, but that would
make them inconsistent. Then there are others that are so long that the
function path string does not even fit in the 80 characters, so we have to do
the disable/enable on pylint (or concatenating strings but that's even uglier).
For consistency, I would like to keep all of them in a single line, and I
also think it's easier to read like that.
If you prefer the explicit `# pylint: disable`/`# pylint: enable` in every
file for the `@mock.patch` lines specifically, I can add them back and revert
the changes in the `.pylintrc`.
----------------------------------------------------------------
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:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 328693)
Time Spent: 68h 50m (was: 68h 40m)
> 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: 68h 50m
> Remaining Estimate: 0h
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)