diff options
Diffstat (limited to 'pecan/tests/test_base.py')
-rw-r--r-- | pecan/tests/test_base.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/pecan/tests/test_base.py b/pecan/tests/test_base.py index 58b5734..6332392 100644 --- a/pecan/tests/test_base.py +++ b/pecan/tests/test_base.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + import sys import os import json @@ -259,6 +261,35 @@ class TestObjectDispatch(PecanTestCase): assert r.body == b_('/sub/sub/deeper') +@unittest.skipIf(not six.PY3, "tests are Python3 specific") +class TestUnicodePathSegments(PecanTestCase): + + def test_unicode_methods(self): + class RootController(object): + pass + setattr(RootController, '🌰', expose()(lambda self: 'Hello, World!')) + app = TestApp(Pecan(RootController())) + + resp = app.get('/%F0%9F%8C%B0/') + assert resp.status_int == 200 + assert resp.body == b_('Hello, World!') + + def test_unicode_child(self): + class ChildController(object): + @expose() + def index(self): + return 'Hello, World!' + + class RootController(object): + pass + setattr(RootController, '🌰', ChildController()) + app = TestApp(Pecan(RootController())) + + resp = app.get('/%F0%9F%8C%B0/') + assert resp.status_int == 200 + assert resp.body == b_('Hello, World!') + + class TestLookups(PecanTestCase): @property |