From 4e24c95a61802fd6fb9a03fdffd0380d90c46e0c Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Sat, 18 Mar 2017 12:11:48 +1300 Subject: optmanager: cope with bound methods in .subscribe Fixes #2122 --- test/mitmproxy/test_optmanager.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'test') diff --git a/test/mitmproxy/test_optmanager.py b/test/mitmproxy/test_optmanager.py index 84e574f5..6f87ac06 100644 --- a/test/mitmproxy/test_optmanager.py +++ b/test/mitmproxy/test_optmanager.py @@ -151,6 +151,21 @@ def test_subscribe(): o.two = 4 assert len(o.changed.receivers) == 0 + class binder: + def __init__(self): + self.o = TO() + self.called = False + self.o.subscribe(self.bound, ["two"]) + + def bound(self, *args, **kwargs): + self.called = True + + t = binder() + t.o.one = 3 + assert not t.called + t.o.two = 3 + assert t.called + def test_rollback(): o = TO() -- cgit v1.2.3