diff options
author | Olivier Tilloy <olivier@tilloy.net> | 2009-04-30 08:40:26 +0200 |
---|---|---|
committer | Olivier Tilloy <olivier@tilloy.net> | 2009-04-30 08:40:26 +0200 |
commit | ca3ecde972bf838ef1a55836af8e769e7ea7bb05 (patch) | |
tree | cad595e9db0bc5e6ef2dd55f5274c529eebb8b23 /unittest/notifying_list.py | |
parent | 4ce12957776efb87f2cf110a63eebaab39c227c2 (diff) | |
download | pyexiv2-ca3ecde972bf838ef1a55836af8e769e7ea7bb05.tar.gz |
Notify on pop().
Diffstat (limited to 'unittest/notifying_list.py')
-rw-r--r-- | unittest/notifying_list.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/unittest/notifying_list.py b/unittest/notifying_list.py index 52baac0..17120b5 100644 --- a/unittest/notifying_list.py +++ b/unittest/notifying_list.py @@ -55,6 +55,9 @@ class SimpleListener(ListenerInterface): def item_inserted(self, index, item): self._notify('item_inserted', index, item) + def item_popped(self, index): + self._notify('item_popped', index) + class TestNotifyingList(unittest.TestCase): @@ -73,6 +76,8 @@ class TestNotifyingList(unittest.TestCase): self.failUnlessRaises(NotImplementedError, self.values.append, 17) self.failUnlessRaises(NotImplementedError, self.values.extend, [11, 22]) self.failUnlessRaises(NotImplementedError, self.values.insert, 4, 24) + self.failUnlessRaises(NotImplementedError, self.values.pop) + self.failUnlessRaises(NotImplementedError, self.values.pop, 3) # TODO: test all operations (insertion, slicing, ...) def test_multiple_listeners(self): @@ -105,4 +110,14 @@ class TestNotifyingList(unittest.TestCase): for listener in listeners: self.failUnlessEqual(listener.notifications, 5) self.failUnlessEqual(listener.last, ('item_inserted', (4, 24))) + self.values.pop() + self.failUnlessEqual(self.values, [5, 7, 9, 13, 24, 57, 2, 17, 11]) + for listener in listeners: + self.failUnlessEqual(listener.notifications, 6) + self.failUnlessEqual(listener.last, ('item_popped', (9,))) + self.values.pop(4) + self.failUnlessEqual(self.values, [5, 7, 9, 13, 57, 2, 17, 11]) + for listener in listeners: + self.failUnlessEqual(listener.notifications, 7) + self.failUnlessEqual(listener.last, ('item_popped', (4,))) # TODO: test all operations (slicing, ...) |