Пример #1
0
 def test_pop_raises(self):
     a = Tracker(states)
     with self.assertRaises(KeyError):
         a.pop_state('foo', sentinel_a)
Пример #2
0
 def test_pop_removes_from_all(self):
     a = Tracker(states)
     a.set_state('foo', sentinel_a)
     a.set_state('foo', sentinel_b)
     a.pop_state('foo', sentinel_a)
     self.assertEqual({sentinel_b}, set(a.all))
Пример #3
0
 def test_set_pop_value(self):
     data = object()
     a = Tracker(states)
     a.set_state('foo', sentinel_a, data)
     v = a.pop_state('foo', sentinel_a)
     self.assertIs(data, v)