Example #1
0
 def test_push_pop(self):
     config = Config({'x': 1, 'y': 2})
     compare(config.x, expected=1)
     compare(config.y, expected=2)
     config.push(Config({'x': 3}))
     compare(config.x, expected=3)
     compare(config.y, expected=2)
     config.pop()
     compare(config.x, expected=1)
     compare(config.y, expected=2)
Example #2
0
 def test_push_empty(self):
     config = Config({'x': 1, 'y': 2})
     compare(config.x, expected=1)
     compare(config.y, expected=2)
     config.push(Config({'x': 3}), empty=True)
     compare(config.x, expected=3)
     with ShouldRaise(AttributeError('y')):
         config.y
     config.pop()
     compare(config.x, expected=1)
     compare(config.y, expected=2)
Example #3
0
 def test_pop_without_push(self):
     config = Config({'x': 1, 'y': 2})
     with ShouldRaise(IndexError('pop from empty list')):
         config.pop()