Exemple #1
0
    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
Exemple #2
0
 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'}
Exemple #3
0
 def repr(self):
     s = StackedObject([{}])
     Assert(repr(s)) == 'StackedObject([{}])'