Back to index

python-cliapp  1.20120630
Public Member Functions | Public Attributes
cliapp.hook_tests.HookTests Class Reference

List of all members.

Public Member Functions

def setUp
def callback
def test_has_no_callbacks_by_default
def test_adds_callback
def test_adds_callback_only_once
def test_calls_callback
def test_removes_callback

Public Attributes

 hook
 args
 kwargs

Detailed Description

Definition at line 23 of file hook_tests.py.


Member Function Documentation

def cliapp.hook_tests.HookTests.callback (   self,
  args,
  kwargs 
)

Definition at line 28 of file hook_tests.py.

00028 
00029     def callback(self, *args, **kwargs):
00030         self.args = args
00031         self.kwargs = kwargs

Here is the caller graph for this function:

Definition at line 25 of file hook_tests.py.

00025 
00026     def setUp(self):
00027         self.hook = Hook()
        

Definition at line 35 of file hook_tests.py.

00035 
00036     def test_adds_callback(self):
00037         self.hook.add_callback(self.callback)
00038         self.assertEqual(self.hook.callbacks, [self.callback])
        

Here is the call graph for this function:

Definition at line 39 of file hook_tests.py.

00039 
00040     def test_adds_callback_only_once(self):
00041         self.hook.add_callback(self.callback)
00042         self.hook.add_callback(self.callback)
00043         self.assertEqual(self.hook.callbacks, [self.callback])

Here is the call graph for this function:

Definition at line 44 of file hook_tests.py.

00044 
00045     def test_calls_callback(self):
00046         self.hook.add_callback(self.callback)
00047         self.hook.call_callbacks('bar', kwarg='foobar')
00048         self.assertEqual(self.args, ('bar',))
00049         self.assertEqual(self.kwargs, { 'kwarg': 'foobar' })

Here is the call graph for this function:

Definition at line 32 of file hook_tests.py.

00032 
00033     def test_has_no_callbacks_by_default(self):
00034         self.assertEqual(self.hook.callbacks, [])
        

Definition at line 50 of file hook_tests.py.

00050 
00051     def test_removes_callback(self):
00052         cb_id = self.hook.add_callback(self.callback)
00053         self.hook.remove_callback(cb_id)
00054         self.assertEqual(self.hook.callbacks, [])
00055 

Here is the call graph for this function:


Member Data Documentation

Definition at line 29 of file hook_tests.py.

Definition at line 26 of file hook_tests.py.

Definition at line 30 of file hook_tests.py.


The documentation for this class was generated from the following file: