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

Unified Diff: tools/json_schema_compiler/json_schema_test.py

Issue 344453003: Docserver: separate models for apps and extensions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Quick fixes Created 6 years, 6 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: tools/json_schema_compiler/json_schema_test.py
diff --git a/tools/json_schema_compiler/json_schema_test.py b/tools/json_schema_compiler/json_schema_test.py
index 80b394643b10ff51d18a5988038def2faa062d76..edbb06e5aa17338acc2f1f774a29962d9a0d3ab6 100755
--- a/tools/json_schema_compiler/json_schema_test.py
+++ b/tools/json_schema_compiler/json_schema_test.py
@@ -78,6 +78,22 @@ class JsonSchemaUnittest(unittest.TestCase):
schema = json_schema.CachedLoad('test/json_schema_test.json')
self.assertEquals(compiled, json_schema.DeleteNodes(schema, 'nocompile'))
+ def should_delete(value):
+ return isinstance(value, dict) and not value.get('valid', True)
+ expected = [
+ {'one': {'test': 'test'}},
+ {'valid': True},
+ {}
+ ]
+ given = [
+ {'one': {'test': 'test'}, 'two': {'valid': False}},
+ {'valid': True},
+ {},
+ {'valid': False}
+ ]
+ self.assertEquals(
+ expected, json_schema.DeleteNodes(given, matcher=should_delete))
+
if __name__ == '__main__':
unittest.main()

Powered by Google App Engine
This is Rietveld 408576698