~lifeless/storm/bug-620615

« back to all changes in this revision

Viewing changes to tests/event.py

  • Committer: Gustavo Niemeyer
  • Date: 2008-06-18 23:13:04 UTC
  • mto: (235.2.21 need-for-speed-revenge)
  • mto: This revision was merged to the branch mainline in revision 245.
  • Revision ID: gustavo@niemeyer.net-20080618231304-iww2kewacv2ux78v
Simplify the calling semantics of _when in the expr module, as
suggested by James.

Show diffs side-by-side

added added

removed removed

Lines of Context:
83
83
 
84
84
        self.assertEquals(called, [marker, marker])
85
85
 
86
 
    def test_save_restore(self):
87
 
        called1 = []
88
 
        called2 = []
89
 
        def callback1(owner, arg):
90
 
            called1.append(arg)
91
 
        def callback2(owner, arg):
92
 
            called2.append(arg)
93
 
 
94
 
        self.event.hook("event", callback1)
95
 
        self.event.save()
96
 
        self.event.hook("event", callback2)
97
 
        self.event.unhook("event", callback1)
98
 
        self.event.emit("event", 1)
99
 
        self.event.emit("event", 2)
100
 
        self.event.restore()
101
 
        self.event.emit("event", 3)
102
 
        self.event.emit("event", 4)
103
 
        self.event.hook("event", callback2)
104
 
        self.event.unhook("event", callback1)
105
 
        self.event.emit("event", 5)
106
 
        self.event.emit("event", 6)
107
 
        self.event.restore()
108
 
        self.event.emit("event", 7)
109
 
        self.event.emit("event", 8)
110
 
 
111
 
        self.assertEquals(called1, [3, 4, 7, 8])
112
 
        self.assertEquals(called2, [1, 2, 5, 6])
113
 
 
114
86
    def test_weak_reference(self):
115
87
        marker = Marker()
116
88