From: Stefan Behnel Date: Sat, 16 Feb 2008 11:33:27 +0000 (+0100) Subject: new tests for various unicode()/str() usage patterns X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=a63120f5223919c73ba0e49977c18d5ce0ab91cc;p=cython.git new tests for various unicode()/str() usage patterns --- diff --git a/tests/run/strfunction.pyx b/tests/run/strfunction.pyx new file mode 100644 index 00000000..2ed6e980 --- /dev/null +++ b/tests/run/strfunction.pyx @@ -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 index 00000000..fe490dff --- /dev/null +++ b/tests/run/unicodefunction.pyx @@ -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) +