diff options
| author | Chris McDonough <chrism@plope.com> | 2012-01-05 03:39:21 -0500 |
|---|---|---|
| committer | Chris McDonough <chrism@plope.com> | 2012-01-05 03:39:21 -0500 |
| commit | 5864016d6432d19fe9588f57d5b1ad95aac9c6c8 (patch) | |
| tree | c9e7bc8a0ce39400e52dce1ca312eb10a5b18161 | |
| parent | a511b1423334f855e996bb06714b36aa86f861e9 (diff) | |
| download | pyramid-5864016d6432d19fe9588f57d5b1ad95aac9c6c8.tar.gz pyramid-5864016d6432d19fe9588f57d5b1ad95aac9c6c8.tar.bz2 pyramid-5864016d6432d19fe9588f57d5b1ad95aac9c6c8.zip | |
add test for pattern and match value having high-order characters in a traverse=
| -rw-r--r-- | pyramid/tests/test_config/test_util.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/pyramid/tests/test_config/test_util.py b/pyramid/tests/test_config/test_util.py index 1180e7e29..0445485cd 100644 --- a/pyramid/tests/test_config/test_util.py +++ b/pyramid/tests/test_config/test_util.py @@ -1,4 +1,5 @@ import unittest +from pyramid.compat import text_ class Test__make_predicates(unittest.TestCase): def _callFUT(self, **kw): @@ -227,6 +228,21 @@ class Test__make_predicates(unittest.TestCase): self.assertEqual(info, {'match': {'a':'a', 'b':'b', 'traverse':('1', 'a', 'b')}}) + def test_traverse_matches_with_highorder_chars(self): + order, predicates, phash = self._callFUT( + traverse=text_('/La Pe\xc3\xb1a/{x}', 'utf-8')) + self.assertEqual(len(predicates), 1) + pred = predicates[0] + info = {'match':{'x':text_(b'Qu\xc3\xa9bec', 'utf-8')}} + request = DummyRequest() + result = pred(info, request) + self.assertEqual(result, True) + self.assertEqual( + info['match']['traverse'], + (text_(b'La Pe\xc3\xb1a', 'utf-8'), + text_(b'Qu\xc3\xa9bec', 'utf-8')) + ) + def test_custom_predicates_can_affect_traversal(self): def custom(info, request): m = info['match'] |
