+
+ def test_remove_extra_items__keep_aditional_properties(self):
+ schema = {
+ "type": "object",
+ "properties": {
+ "a": {
+ "type": "object",
+ "properties": {
+ "type": "object",
+ "properties": {"b": "string"},
+ },
+ "additionalProperties": True,
+ }
+ },
+ }
+
+ example = {"a": {"b": 1, "c": 2}, "d": 3}
+ deleted = remove_extra_items(example, schema)
+ self.assertIn("d", deleted)
+ self.assertIs(example.get("d"), None)
+ self.assertEqual(example["a"]["c"], 2)
+
+
+if __name__ == "__main__":