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() |