Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(643)

Unified Diff: recipe_modules/json/example.py

Issue 1773273003: Make output placeholders like json.output index-able by name. (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/recipes-py@master
Patch Set: Address comments. Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: recipe_modules/json/example.py
diff --git a/recipe_modules/json/example.py b/recipe_modules/json/example.py
index 38b50d57b4eebccba0b0b21c802d72de25edb18c..d04f1f80f7a4d591d8c9f6c30f26eb14616c8e1d 100644
--- a/recipe_modules/json/example.py
+++ b/recipe_modules/json/example.py
@@ -26,7 +26,7 @@ def RunSteps(api):
assert api.json.is_serializable('foo')
assert not api.json.is_serializable(set(['foo', 'bar', 'baz']))
- # Example demonstrating multiple json output files.
+ # Example demonstrating multiple named json output files.
result = api.python.inline(
'foo',
"""
@@ -37,9 +37,11 @@ def RunSteps(api):
with open(sys.argv[2], 'w') as f:
f.write(json.dumps(['x', 'y', %s]))
""" % repr(FULLWIDTH_Z),
- args=[api.json.output(), api.json.output()],
+ args=[api.json.output(name='1'), api.json.output(name='2')],
)
- assert result.json.output_all == [[1, 2, 3], ['x', 'y', FULLWIDTH_Z]]
+ assert result.json.outputs['1'] == [1, 2, 3]
+ assert result.json.outputs['2'] == ['x', 'y', FULLWIDTH_Z]
+ assert result.json.output is None
example_dict = {'x': 1, 'y': 2}
@@ -66,6 +68,6 @@ def GenTests(api):
api.step_data('echo1', stdout=api.json.output([1, 2, 3])) +
api.step_data(
'foo',
- api.json.output([1, 2, 3]) +
- api.json.output(['x', 'y', FULLWIDTH_Z]),
+ api.json.output([1, 2, 3], name='1') +
+ api.json.output(['x', 'y', FULLWIDTH_Z], name='2'),
))

Powered by Google App Engine
This is Rietveld 408576698