def test_merge_simple_dicts_with_precedence(self): a = {'a': 'value', 'ab': 'overwritten'} b = {'b': 'other value', 'ab': 'keep'} assert utils.merge(a, b) == { 'a': 'value', 'b': 'other value', 'ab': 'keep' }
def test_merge_simple_dicts_with_precedence(self): a = {"a": "value", "ab": "overwritten"} b = {"b": "other value", "ab": "keep"} assert utils.merge(a, b) == { "a": "value", "b": "other value", "ab": "keep" }
def wrapper(func): doc = { 'responses': { code: (description, [fields]) if as_list else (description, fields) }, '__mask__': kwargs.get( 'mask', True ), # Mask values can't be determined outside app context } func.__apidoc__ = merge(getattr(func, '__apidoc__', {}), doc) return marshal_with(fields, ordered=self.ordered, **kwargs)(func)
def test_recursions_with_empty(self): a = {} b = { 'b': 'other value', 'ab': 'keep', 'nested_b': { 'b': 'nested' }, 'nested_a_b': { 'b': 'b only', 'ab': 'keep' } } assert utils.merge(a, b) == b
def test_recursions_with_empty(self): a = {} b = { "b": "other value", "ab": "keep", "nested_b": { "b": "nested" }, "nested_a_b": { "b": "b only", "ab": "keep" }, } assert utils.merge(a, b) == b
def _handle_api_doc(self, cls, doc): if doc is False: cls.__apidoc__ = False return ##unshortcut_params_description(doc) ##handle_deprecations(doc) ##for key in 'get', 'post', 'put', 'delete', 'options', 'head', 'patch': ## if key in doc: ## if doc[key] is False: ## continue ## unshortcut_params_description(doc[key]) ## handle_deprecations(doc[key]) ## if 'expect' in doc[key] and not isinstance(doc[key]['expect'], (list, tuple)): ## doc[key]['expect'] = [doc[key]['expect']] cls.__apidoc__ = merge(getattr(cls, '__apidoc__', {}), doc)
def test_recursions(self): a = { 'a': 'value', 'ab': 'overwritten', 'nested_a': { 'a': 'nested' }, 'nested_a_b': { 'a': 'a only', 'ab': 'overwritten' } } b = { 'b': 'other value', 'ab': 'keep', 'nested_b': { 'b': 'nested' }, 'nested_a_b': { 'b': 'b only', 'ab': 'keep' } } assert utils.merge(a, b) == { 'a': 'value', 'b': 'other value', 'ab': 'keep', 'nested_a': { 'a': 'nested' }, 'nested_b': { 'b': 'nested' }, 'nested_a_b': { 'a': 'a only', 'b': 'b only', 'ab': 'keep' } }
def test_recursions(self): a = { "a": "value", "ab": "overwritten", "nested_a": { "a": "nested" }, "nested_a_b": { "a": "a only", "ab": "overwritten" }, } b = { "b": "other value", "ab": "keep", "nested_b": { "b": "nested" }, "nested_a_b": { "b": "b only", "ab": "keep" }, } assert utils.merge(a, b) == { "a": "value", "b": "other value", "ab": "keep", "nested_a": { "a": "nested" }, "nested_b": { "b": "nested" }, "nested_a_b": { "a": "a only", "b": "b only", "ab": "keep" }, }
def test_merge_simple_dicts_without_precedence(self): a = {'a': 'value'} b = {'b': 'other value'} assert utils.merge(a, b) == {'a': 'value', 'b': 'other value'}
def test_merge_simple_dicts_without_precedence(self): a = {"a": "value"} b = {"b": "other value"} assert utils.merge(a, b) == {"a": "value", "b": "other value"}