diff options
author | Bert JW Regeer <bertjw@regeer.org> | 2020-01-21 22:43:18 -0800 |
---|---|---|
committer | Bert JW Regeer <bertjw@regeer.org> | 2020-11-28 12:19:53 -0800 |
commit | 5239a8f4663884063e55cff022a66cfd144e2996 (patch) | |
tree | 1d4da59811795010a5f1d0a2a05a005d131dc0fa /tests | |
parent | 03bc46292de9fe9ae462efd5509f2375bb5a5495 (diff) | |
download | webob-5239a8f4663884063e55cff022a66cfd144e2996.tar.gz |
Remove __unicode__
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_exc.py | 2 | ||||
-rw-r--r-- | tests/test_misc.py | 15 |
2 files changed, 6 insertions, 11 deletions
diff --git a/tests/test_exc.py b/tests/test_exc.py index 35454c9..8dc95f3 100644 --- a/tests/test_exc.py +++ b/tests/test_exc.py @@ -24,7 +24,7 @@ def test_noescape_not_basestring(): def test_noescape_unicode(): class DummyUnicodeObject(object): - def __unicode__(self): + def __str__(self): return "42" duo = DummyUnicodeObject() diff --git a/tests/test_misc.py b/tests/test_misc.py index 79eee6d..0ac4e0d 100644 --- a/tests/test_misc.py +++ b/tests/test_misc.py @@ -8,8 +8,8 @@ class t_esc_HTML(object): class t_esc_Unicode(object): - def __unicode__(self): - return text_(b"\xe9") + def __str__(self): + return "\xe9" class t_esc_UnsafeAttrs(object): @@ -24,10 +24,7 @@ class t_esc_UnsafeAttrs(object): class t_esc_SuperMoose(object): def __str__(self): - return text_(b"m\xf8ose").encode("utf-8") - - def __unicode__(self): - return text_(b"m\xf8ose") + return "m\xf8ose" @pytest.mark.parametrize( @@ -39,17 +36,15 @@ class t_esc_SuperMoose(object): # The apostrophe is *not* escaped, which some might consider to be # a serious bug (see, e.g. http://www.cvedetails.com/cve/CVE-2010-2480/) pytest.param("'", "'"), - (text_("the majestic m\xf8ose"), "the majestic møose"), + ("the majestic m\xf8ose", "the majestic møose"), # 8-bit strings are passed through - (text_("\xe9"), "é"), + ("\xe9", "é"), # ``None`` is treated specially, and returns the empty string. (None, ""), # Objects that define a ``__html__`` method handle their own escaping (t_esc_HTML(), "<div>hello</div>"), # Things that are not strings are converted to strings and then escaped (42, "42"), - # If an object implements both ``__str__`` and ``__unicode__``, the latter - # is preferred (t_esc_SuperMoose(), "møose"), (t_esc_Unicode(), "é"), (t_esc_UnsafeAttrs(), "<UnsafeAttrs>"), |