gristlabs_grist-core/sandbox/grist/test_urllib_patch.py
Alex Hall 305b133c59 (core) Remaining Python 3 compatibility changes
Summary: Biggest change is turning everything to unicode

Test Plan: The tests

Reviewers: dsagal, paulfitz

Reviewed By: dsagal

Differential Revision: https://phab.getgrist.com/D2875
2021-06-25 12:00:58 +02:00

20 lines
579 B
Python

# coding=utf-8
import unittest
import urllib
import six
from urllib_patch import original_quote
class TestUrllibPatch(unittest.TestCase):
def test_patched_quote(self):
self.assertEqual(urllib.quote( "a b"), u"a%20b")
self.assertEqual(urllib.quote(u"a b"), u"a%20b")
self.assertEqual(urllib.quote(u"a é"), u"a%20%C3%A9")
self.assertEqual(original_quote( "a b"), u"a%20b")
self.assertEqual(original_quote(u"a b"), u"a%20b")
if six.PY3: # python 2 original quote can't handle non-ascii
self.assertEqual(original_quote(u"a é"), u"a%20%C3%A9")