summaryrefslogtreecommitdiff
path: root/tests/test_compat.py
blob: 1940e7998f5eb7e833d4085c6e0f2a4af800bddf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import unittest


class Test_unquote_bytes_to_wsgi(unittest.TestCase):
    def _callFUT(self, v):
        from waitress.compat import unquote_bytes_to_wsgi

        return unquote_bytes_to_wsgi(v)

    def test_highorder(self):
        from waitress.compat import PY3

        val = b"/a%C5%9B"
        result = self._callFUT(val)
        if PY3:  # pragma: no cover
            # PEP 3333 urlunquoted-latin1-decoded-bytes
            self.assertEqual(result, "/aÅ\x9b")
        else:  # pragma: no cover
            # sanity
            self.assertEqual(result, b"/a\xc5\x9b")