def test_deep_remove_type_error(): node = {'key': 'value'} with pytest.raises(TypeError): deep_remove(node, ['key'])
def test_deep_remove(): nested = Object({'key': [{'abc': 123}, {'def': 456}], 'other': 0}) assert deep_remove(nested, ['key', 0]) == {'key': [{'def': 456}], 'other': 0} assert deep_remove(nested, ['key']) == {'other': 0} assert deep_remove(nested, []) is None