add regression test for non-optimised unicode.encode() calls
authorStefan Behnel <stefan_ml@behnel.de>
Sun, 3 Nov 2013 17:30:31 +0000 (18:30 +0100)
committerStefan Behnel <stefan_ml@behnel.de>
Sun, 3 Nov 2013 17:30:31 +0000 (18:30 +0100)
tests/run/unicodeencode.pyx

index 91dbbb3..c98b9a7 100644 (file)
@@ -20,6 +20,15 @@ def default():
     """
     return u'abcdefg'.encode()
 
+def encode_non_constant(encoding):
+    """
+    >>> isinstance(encode_non_constant('utf8'), _bytes)
+    True
+    >>> encode_non_constant('utf8') == u.encode('UTF-8')
+    True
+    """
+    return text.encode(encoding)
+
 @cython.test_assert_path_exists('//PythonCapiFunctionNode[@cname = "PyUnicode_AsUTF8String"]')
 def utf8():
     """