File: test_codecutil.py

package info (click to toggle)
python3-openid 3.0.2%2Bgit20140828-1
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 1,672 kB
  • ctags: 2,679
  • sloc: python: 17,137; xml: 234; sh: 15; makefile: 4
file content (21 lines) | stat: -rw-r--r-- 519 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import unittest

from openid import codecutil  # registers encoder


class EncoderTest(unittest.TestCase):
    def test_handler_registered(self):
        self.assertEqual(
            "foo".encode('ascii', errors='oid_percent_escape'),
            b"foo")

    def test_encoding(self):
        s = 'l\xa1m\U00101010n'
        expected = b'l%C2%A1m%F4%81%80%90n'
        self.assertEqual(
            s.encode('ascii', errors='oid_percent_escape'),
            expected)


if __name__ == '__main__':
    unittest.main()