def test_sort_dict_keys_from_reflist_nested(self): """Test function.""" data = dict(foo=dict(inner1=1, inner2=2), bar=2, baz=3, quux=4) ref = ['quux', 'baz', 'foo', 'bar'] expected = [ ('quux', 4), ('baz', 3), ('foo', {'inner1': 1, 'inner2': 2}), ('bar', 2)] assert munging.sort_dict_keys_from_reflist(data, ref) == expected
def test_sort_dict_keys_from_reflist_nested(self): """Test function.""" data = dict(foo=dict(inner1=1, inner2=2), bar=2, baz=3, quux=4) ref = ['quux', 'baz', 'foo', 'bar'] expected = [('quux', 4), ('baz', 3), ('foo', { 'inner1': 1, 'inner2': 2 }), ('bar', 2)] assert munging.sort_dict_keys_from_reflist(data, ref) == expected
def test_sort_dict_keys_from_reflist_missing_val(self): """Test function.""" data = dict(foo=1, bar=2, baz=3, quux=4) ref = ['quux', 'baz', 'foo'] expected = [('quux', 4), ('baz', 3), ('foo', 1)] assert munging.sort_dict_keys_from_reflist(data, ref) == expected
def test_sort_dict_keys_from_reflist_none(self): """Test function.""" data = dict(foo=None, bar=2, baz=3, quux=4) ref = ['quux', 'baz', 'foo', 'bar'] expected = [('quux', 4), ('baz', 3), ('foo', None), ('bar', 2)] assert munging.sort_dict_keys_from_reflist(data, ref) == expected
def test_sort_dict_keys_from_reflist_missing_val(self): """Test function.""" data = dict(foo=1, bar=2, baz=3, quux=4) ref = ['quux', 'baz', 'foo'] expected = [('quux', 4), ('baz', 3), ('foo', 1)] assert munging.sort_dict_keys_from_reflist(data, ref) == expected
def test_sort_dict_keys_from_reflist_none(self): """Test function.""" data = dict(foo=None, bar=2, baz=3, quux=4) ref = ['quux', 'baz', 'foo', 'bar'] expected = [('quux', 4), ('baz', 3), ('foo', None), ('bar', 2)] assert munging.sort_dict_keys_from_reflist(data, ref) == expected