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

Unified Diff: recipe_modules/json/example.py

Issue 2768883004: json: Improve error handling and adding ability to limit log output.
Patch Set: Created 3 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 5ecc78d6d7aad543025828794f2990d86d2eb689..99aadb86fe809d1c37e3c15bcbd0128648057ad7 100644
--- a/recipe_modules/json/example.py
+++ b/recipe_modules/json/example.py
@@ -78,6 +78,21 @@ def RunSteps(api):
])
assert step_result.json.output is None
+ # empty json data is explicit
+ step_result = api.step('empty json', [
+ 'python', api.resource('cool_script.py'),
+ '',
+ api.json.output(),
+ ])
+ assert step_result.json.output is None
+
+ # empty json data is explicit
+ step_result = api.step('None json', [
+ 'python', api.resource('cool_script.py'),
+ api.json.output(),
+ ])
+ assert step_result.json.output is None
+
def GenTests(api):
yield (
@@ -96,4 +111,8 @@ def GenTests(api):
'invalid json',
api.json.invalid('{"here is some total\ngarbage'),
)
+ + api.step_data(
+ 'empty json',
+ api.json.invalid(''),
+ )
)

Powered by Google App Engine
This is Rietveld 408576698