aboutsummaryrefslogtreecommitdiffstats
path: root/unittest/notifying_list.py
diff options
context:
space:
mode:
authorOlivier Tilloy <olivier@tilloy.net>2009-04-28 23:48:26 +0200
committerOlivier Tilloy <olivier@tilloy.net>2009-04-28 23:48:26 +0200
commit73230664fba218f598bf7b7f9e110fa346bf5622 (patch)
treeeb983fdf8ba54ca93829f1754dfb90a525bb57f7 /unittest/notifying_list.py
parent6a0980ac1cb704dd115748c808d7a9e4aa1fd05a (diff)
downloadpyexiv2-73230664fba218f598bf7b7f9e110fa346bf5622.tar.gz
Test the list values after operations.
Diffstat (limited to 'unittest/notifying_list.py')
-rw-r--r--unittest/notifying_list.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/unittest/notifying_list.py b/unittest/notifying_list.py
index 862f45a..4ba463e 100644
--- a/unittest/notifying_list.py
+++ b/unittest/notifying_list.py
@@ -79,18 +79,23 @@ class TestNotifyingList(unittest.TestCase):
listener = SimpleListener()
self.values.register_listener(listener)
self.values[3] = 13
+ self.failUnlessEqual(self.values, [5, 7, 9, 13, 57, 3, 2])
self.failUnlessEqual(listener.notifications, 1)
self.failUnlessEqual(listener.last, ('item_changed', (3, 13)))
del self.values[5]
+ self.failUnlessEqual(self.values, [5, 7, 9, 13, 57, 2])
self.failUnlessEqual(listener.notifications, 2)
self.failUnlessEqual(listener.last, ('item_deleted', (5,)))
self.values.append(17)
+ self.failUnlessEqual(self.values, [5, 7, 9, 13, 57, 2, 17])
self.failUnlessEqual(listener.notifications, 3)
self.failUnlessEqual(listener.last, ('item_appended', (17,)))
self.values.extend([11, 22])
+ self.failUnlessEqual(self.values, [5, 7, 9, 13, 57, 2, 17, 11, 22])
self.failUnlessEqual(listener.notifications, 4)
self.failUnlessEqual(listener.last, ('extended', ([11, 22],)))
self.values.insert(4, 24)
+ self.failUnlessEqual(self.values, [5, 7, 9, 13, 24, 57, 2, 17, 11, 22])
self.failUnlessEqual(listener.notifications, 5)
self.failUnlessEqual(listener.last, ('item_inserted', (4, 24)))
# TODO: test all operations (slicing, ...)
@@ -101,22 +106,27 @@ class TestNotifyingList(unittest.TestCase):
for listener in listeners:
self.values.register_listener(listener)
self.values[3] = 13
+ self.failUnlessEqual(self.values, [5, 7, 9, 13, 57, 3, 2])
for listener in listeners:
self.failUnlessEqual(listener.notifications, 1)
self.failUnlessEqual(listener.last, ('item_changed', (3, 13)))
del self.values[5]
+ self.failUnlessEqual(self.values, [5, 7, 9, 13, 57, 2])
for listener in listeners:
self.failUnlessEqual(listener.notifications, 2)
self.failUnlessEqual(listener.last, ('item_deleted', (5,)))
self.values.append(17)
+ self.failUnlessEqual(self.values, [5, 7, 9, 13, 57, 2, 17])
for listener in listeners:
self.failUnlessEqual(listener.notifications, 3)
self.failUnlessEqual(listener.last, ('item_appended', (17,)))
self.values.extend([11, 22])
+ self.failUnlessEqual(self.values, [5, 7, 9, 13, 57, 2, 17, 11, 22])
for listener in listeners:
self.failUnlessEqual(listener.notifications, 4)
self.failUnlessEqual(listener.last, ('extended', ([11, 22],)))
self.values.insert(4, 24)
+ self.failUnlessEqual(self.values, [5, 7, 9, 13, 24, 57, 2, 17, 11, 22])
for listener in listeners:
self.failUnlessEqual(listener.notifications, 5)
self.failUnlessEqual(listener.last, ('item_inserted', (4, 24)))