new tests for various unicode()/str() usage patterns
authorStefan Behnel <scoder@users.berlios.de>
Sat, 16 Feb 2008 11:33:27 +0000 (12:33 +0100)
committerStefan Behnel <scoder@users.berlios.de>
Sat, 16 Feb 2008 11:33:27 +0000 (12:33 +0100)
tests/run/strfunction.pyx [new file with mode: 0644]
tests/run/unicodefunction.pyx [new file with mode: 0644]

diff --git a/tests/run/strfunction.pyx b/tests/run/strfunction.pyx
new file mode 100644 (file)
index 0000000..2ed6e98
--- /dev/null
@@ -0,0 +1,35 @@
+__doc__ = """
+   >>> s('test')
+   'test'
+   >>> z
+   'test'
+   >>> c('testing')
+   'testing'
+   >>> sub('testing a subtype')
+   'testing a subtype'
+   >>> subs('testing a subtype')
+   'testing a subtype'
+
+#   >>> csub('testing a subtype')
+#   'testing a subtype'
+#   >>> csubs('testing a subtype')
+#   'testing a subtype'
+"""
+
+s = str
+z = str('test')
+
+def c(string):
+    return str(string)
+
+class subs(str):
+    pass
+
+def sub(string):
+    return subs(string)
+
+#cdef class subs(str):
+#    pass
+
+#def csub(string):
+#    return csubs(string)
diff --git a/tests/run/unicodefunction.pyx b/tests/run/unicodefunction.pyx
new file mode 100644 (file)
index 0000000..fe490df
--- /dev/null
@@ -0,0 +1,36 @@
+__doc__ = """
+   >>> u('test')
+   u'test'
+   >>> z
+   u'test'
+   >>> c('testing')
+   u'testing'
+   >>> subu('testing a Python subtype')
+   u'testing a Python subtype'
+   >>> sub('testing a Python subtype')
+   u'testing a Python subtype'
+
+#   >>> csubu('testing a C subtype')
+#   u'testing a C subtype'
+#   >>> csub('testing a C subtype')
+#   u'testing a C subtype'
+"""
+
+u = unicode
+z = unicode('test')
+
+def c(string):
+    return unicode(string)
+
+class subu(unicode):
+    pass
+
+def sub(string):
+    return subu(string)
+
+#cdef class csubu(unicode):
+#    pass
+
+#def csub(string):
+#    return csubu(string)
+