예제 #1
0
    def test_exceptions(self):
        gate = Gate()
        gate.setup(dict())

        with raises(RuntimeError):
            gate.setup(dict())

        with raises(ValueError):
            gate.retrieve('does-not-exist')

        gate.teardown()

        with raises(RuntimeError):
            gate.teardown()
예제 #2
0
    def test_basics(self):
        gate = Gate()
        gate.setup(dict())

        gate.attach('text', 'Hallo world!')
        assert gate.retrieve('text') == 'Hallo world!'
        assert gate.contains('text')
        gate.release('text')
        assert not gate.contains('text')

        gate.teardown()

        with raises(RuntimeError):
            gate.teardown()