def top(self): s = StackedObject([]) Assert(s.top) == {} s.push({'foo': 'bar'}) Assert(s.top) == {'foo': 'bar'} s.push({'foo': 'baz'}) Assert(s.top) == {'foo': 'baz'}
def stacking(self): s = StackedObject([]) with Assert.raises(AttributeError): s.foo with Assert.raises(RuntimeError): s.pop() s.push({'foo': False}) Assert(s.foo) == False s.push({'foo': True}) Assert(s.foo) == True s.pop() Assert(s.foo) == False
def repr(self): s = StackedObject([{}]) Assert(repr(s)) == 'StackedObject([{}])'