Skip to content

Instantly share code, notes, and snippets.

@SirEdvin
Created March 22, 2019 16:21
Show Gist options
  • Save SirEdvin/17f9d8e896dc4d50a4def35c5d8e0582 to your computer and use it in GitHub Desktop.
Save SirEdvin/17f9d8e896dc4d50a4def35c5d8e0582 to your computer and use it in GitHub Desktop.
def test_base_propagation():
class C1(funcsubs.SubscribableMixin):
t1 = True
t2 = True
t3 = True
def test1(self):
TEST_HOOK.append(1)
class C2(C1):
t1 = False
class C3(C2):
t2 = False
C1.pre_hook(C1.test1, simple_hook, lambda x: x.t1)
C1.pre_hook(C1.test1, simple_hook_5, lambda x: x.t2)
C1.pre_hook(C1.test1, simple_hook_7, lambda x: x.t3)
TEST_HOOK.clear()
C1().test1()
assert len(TEST_HOOK) == 4
assert TEST_HOOK == [0, 5, 7, 1]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment