Пример #1
0
    def test_hookbind_param(self):
        trigger = triggers.get('test_hooks/test_0')

        def test_callback(matchable, param):
            self.assertEqual(True, param['test'])

        trigger.bind(test_callback, {'test': True})
        trigger.call_methods()
Пример #2
0
    def test_hookbind_noparam(self):
        trigger = triggers.get('test_hooks/test_0')

        def test_callback(matchable):
            pass

        trigger.bind(test_callback)
        trigger.call_methods()
Пример #3
0
    def test_hook_multi(self):
        trigger = triggers.get('test_hooks/test_0')

        def test_callback_1(matchable, param):
            self.assertEqual(True, param['test'])

        def test_callback_2(matchable, param):
            self.assertEqual(False, param['an_arg'])

        trigger.bind(test_callback_1, {'test': True})
        trigger.bind(test_callback_2, {'an_arg': False})

        trigger.call_methods()
Пример #4
0
 def test_fail_get_trigger(self):
     trigger = triggers.get('test_get/fail_30')
     self.assertEqual(trigger, None)
Пример #5
0
 def test_get_subtrigger(self):
     trigger = triggers.get('test_get/subgroup/test_42')
     self.assertEqual(trigger.name, 'test_42')
Пример #6
0
 def test_get_subgroup(self):
     new_subgroup = triggers.get('test_get/subgroup')
     self.assertEqual(new_subgroup.name, 'subgroup')
Пример #7
0
 def test_get_trigger(self):
     trigger = triggers.get('test_get/test_30')
     self.assertEqual(trigger.name, 'test_30')
Пример #8
0
 def test_get_group(self):
     newgroup = triggers.get('test_get')
     self.assertEqual(newgroup.name, 'test_get')
Пример #9
0
 def test_child_removal(self):
     triggers.get('dummy/subdummy').destroy()
     self.assertIn('dummy', triggers.groups)
     self.assertEqual(len(apps.groups['dummyapp']), 1)
Пример #10
0
 def test_parent_removal(self):
     triggers.get('dummy').destroy()
     self.assertNotIn('dummy', triggers.groups)
     self.assertEqual(len(apps.groups['dummyapp']), 0)
Пример #11
0
 def test_subgroup_ownership(self):
     group = triggers.get('dummy/subdummy')
     self.assertEqual('dummyapp', group.app)