Ejemplo n.º 1
0
 def test_single(self):
     def fn():
         pass
     callables = {
         'fn': fn,
     }
     data = visitor.visit(callables)
     assert len(data) == 1
     assert data[0]['name'] == 'fn'
Ejemplo n.º 2
0
 def test_multi(self):
     def fn():
         pass
     def fn2():
         pass
     def fn3():
         pass
     callables = {
         'fn': fn,
         'fn2': fn2,
         'fn3': fn3,
     }
     data = visitor.visit(callables)
     assert len(data) == 3
     assert data[0]['name'] == 'fn'
     assert data[1]['name'] == 'fn2'
     assert data[2]['name'] == 'fn3'
Ejemplo n.º 3
0
 def test_nested(self):
     def fn():
         pass
     def fn2():
         pass
     def fn3():
         pass
     callables = {
         'fn': fn,
         'mod': {
             'fn2': fn2,
             'fn3': fn3,
         }
     }
     data = visitor.visit(callables)
     assert len(data) == 3
     assert data[0]['name'] == 'fn'
     assert data[0]['path'] == ()
     assert data[1]['name'] == 'fn2'
     assert data[1]['path'] == ('mod',)
     assert data[2]['name'] == 'fn3'
     assert data[2]['path'] == ('mod',)