Example #1
0
 def test_nested_iterate_dict(self):
     d = dict(foo=123, bar=456, baz=dict(zip='zap', foobar=42))
     result = sorted(util.dict_iterate_paths(d))
     self.assertEqual(result, [('bar', 456), ('baz', {'foobar': 42, 'zip': 'zap'}), ('baz.foobar', 42), ('baz.zip', 'zap'), ('foo', 123)])
Example #2
0
 def test_iterate_dict(self):
     d = dict(foo=123, bar=456)
     result = set(util.dict_iterate_paths(d))
     self.assertEqual(set([('foo', 123), ('bar', 456)]), result)