File: test_quoting.py

package info (click to toggle)
paste 3.10.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,472 kB
  • sloc: python: 19,960; javascript: 8,028; makefile: 47; sh: 24
file content (25 lines) | stat: -rw-r--r-- 997 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
from paste.util import quoting
import unittest

class TestQuoting(unittest.TestCase):
    def test_html_unquote(self):
        self.assertEqual(quoting.html_unquote(b'<hey you>'),
                         '<hey\xa0you>')
        self.assertEqual(quoting.html_unquote(b''),
                         '')
        self.assertEqual(quoting.html_unquote(b'&blahblah;'),
                         '&blahblah;')
        self.assertEqual(quoting.html_unquote(b'\xe1\x80\xa9'),
                         '\u1029')

    def test_html_quote(self):
        self.assertEqual(quoting.html_quote(1),
                         '1')
        self.assertEqual(quoting.html_quote(None),
                         '')
        self.assertEqual(quoting.html_quote('<hey!>'),
                         '&lt;hey!&gt;')
        self.assertEqual(quoting.html_quote(b'<hey!>'),
                         b'&lt;hey!&gt;')
        self.assertEqual(quoting.html_quote('<\u1029>'),
                         '&lt;\u1029&gt;')