Ejemplo n.º 1
0
def test_context_collection():
    o = ContextCollection(['base'])

    o.append('child-1')

    assert o.current == ['base', 'child-1']
    assert o[0] == 'base'
    assert o[-1] == 'child-1'

    o.append('child-2')
    assert o.current == ['base', 'child-1', 'child-2']
    assert o[-1] == 'child-2'

    o.pop()
    assert o.current == ['base', 'child-1']
    assert o[-1] == 'child-1'
Ejemplo n.º 2
0
def test_context_collection():
    o = ContextCollection(
        ['base']
    )

    o.append('child-1')

    assert o.current == ['base', 'child-1']
    assert o[0] == 'base'
    assert o[-1] == 'child-1'

    o.append('child-2')
    assert o.current == ['base', 'child-1', 'child-2']
    assert o[-1] == 'child-2'

    o.pop()
    assert o.current == ['base', 'child-1']
    assert o[-1] == 'child-1'
Ejemplo n.º 3
0
    def __init__(self):
        self.defaults = Configuration(self)
        self.stack = ContextCollection([self.defaults])

        self.oauth = OAuthConfiguration(self)