forked from bottlepy/bottle
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_route.py
More file actions
30 lines (23 loc) · 804 Bytes
/
test_route.py
File metadata and controls
30 lines (23 loc) · 804 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import unittest
import bottle
from tools import api
class TestRoute(unittest.TestCase):
@api('0.12')
def test_callback_inspection(self):
def x(a, b): pass
def d(f):
def w():
return f()
return w
route = bottle.Route(None, None, None, d(x))
self.assertEqual(route.get_undecorated_callback(), x)
self.assertEqual(set(route.get_callback_args()), set(['a', 'b']))
def d2(foo):
def d(f):
def w():
return f()
return w
return d
route = bottle.Route(None, None, None, d2('foo')(x))
self.assertEqual(route.get_undecorated_callback(), x)
self.assertEqual(set(route.get_callback_args()), set(['a', 'b']))