diff options
author | Aric Coady <aric.coady@gmail.com> | 2014-05-06 16:36:09 -0700 |
---|---|---|
committer | Aric Coady <aric.coady@gmail.com> | 2014-05-06 16:36:09 -0700 |
commit | 9b5e539f67bec2529e551be77866dd0c9a043dcb (patch) | |
tree | 8a8620111ba35e64a918025b01b2472c6b2b6a06 | |
parent | e371aad440a719fa61c46ea43ec1a71acb700f82 (diff) | |
download | cherrypy-9b5e539f67bec2529e551be77866dd0c9a043dcb.tar.gz |
Test keyword-only syntax in dispatchers.
-rw-r--r-- | cherrypy/test/test_objectmapping.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/cherrypy/test/test_objectmapping.py b/cherrypy/test/test_objectmapping.py index 28362b63..e80a7a71 100644 --- a/cherrypy/test/test_objectmapping.py +++ b/cherrypy/test/test_objectmapping.py @@ -1,3 +1,4 @@ +import sys import cherrypy from cherrypy._cpcompat import ntou from cherrypy._cptree import Application @@ -414,3 +415,17 @@ class ObjectMappingTest(helper.CPWebCase): a = Application(Root(), script_name=None) # However, this does not apply to tree.mount self.assertRaises(TypeError, cherrypy.tree.mount, a, None) + + def testKeywords(self): + if sys.version_info < (3,): + return self.skip("skipped (Python 3 only)") + exec("""class Root(object): + @cherrypy.expose + def hello(self, *, name='world'): + return 'Hello %s!' % name +cherrypy.tree.mount(Application(Root(), '/keywords'))""") + + self.getPage('/keywords/hello') + self.assertStatus(200) + self.getPage('/keywords/hello/extra') + self.assertStatus(404) |