def test_dictlike(): class Base(object): properties = Properties({'def': 456}, abc=123) props = Base.properties assert sorted(props.items()) == [('abc', 123), ('def', 456)] assert sorted(props.keys()) == ['abc', 'def'] assert sorted(iterkeys(props)) == ['abc', 'def'] assert sorted(props.values()) == [123, 456] assert sorted(itervalues(props)) == [123, 456] assert props.get('abc') == 123 assert props.get('abc', 'blah') == 123 assert props.get('blah', 'default') == 'default' assert props.get('blah') is None assert_raises(NotImplementedError, props.popitem) assert 'abc' in props assert 'ghi' not in props assert props == {'abc': 123, 'def': 456} assert props != {'ghi': 789} assert props props.clear() assert not props assert repr(props) == '{}'
def values(self): return list(itervalues(self))
def children(self): # order not guaranteed return itervalues(self)