mirror of
https://github.com/sqlalchemy/sqlalchemy.git
synced 2026-05-30 04:24:38 -04:00
- repair bool() for instance level event listener where events are classlevel, continuing [ticket:2516]
This commit is contained in:
@@ -352,7 +352,7 @@ class _EmptyListener(object):
|
||||
return iter(self.parent_listeners)
|
||||
|
||||
def __nonzero__(self):
|
||||
return False
|
||||
return bool(self.parent_listeners)
|
||||
|
||||
class _CompoundListener(object):
|
||||
_exec_once = False
|
||||
|
||||
@@ -50,6 +50,13 @@ class EventsTest(fixtures.TestBase):
|
||||
eq_(len(self.Target().dispatch.event_two), 0)
|
||||
eq_(len(t1.dispatch.event_two), 0)
|
||||
|
||||
def test_bool_clslevel(self):
|
||||
def listen_one(x, y):
|
||||
pass
|
||||
event.listen(self.Target, "event_one", listen_one)
|
||||
t = self.Target()
|
||||
assert t.dispatch.event_one
|
||||
|
||||
def test_register_class_instance(self):
|
||||
def listen_one(x, y):
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user