From: Stefan Behnel Date: Thu, 22 Apr 2010 13:08:42 +0000 (+0200) Subject: extended test case X-Git-Tag: 0.13.beta0~158 X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=b5cfad6e4bb445ad7ca2f433c01d51f7401fa257;p=cython.git extended test case --- diff --git a/tests/run/inop.pyx b/tests/run/inop.pyx index b2d7733a..917eff71 100644 --- a/tests/run/inop.pyx +++ b/tests/run/inop.pyx @@ -113,6 +113,24 @@ def m_bytes(char a, bytes bytes_string): cdef int result = a in bytes_string return result +@cython.test_assert_path_exists("//PrimaryCmpNode") +@cython.test_fail_if_path_exists("//SwitchStatNode", "//BoolBinopNode") +def m_bytes_unsigned(unsigned char a, bytes bytes_string): + """ + >>> m_bytes(ord('f'), py_bytes_string) + 1 + >>> m_bytes(ord('X'), py_bytes_string) + 0 + >>> 'f'.encode('ASCII') in None + Traceback (most recent call last): + TypeError: argument of type 'NoneType' is not iterable + >>> m_bytes(ord('f'), None) + Traceback (most recent call last): + TypeError: argument of type 'NoneType' is not iterable + """ + cdef int result = a in bytes_string + return result + @cython.test_assert_path_exists("//SwitchStatNode") @cython.test_fail_if_path_exists("//BoolBinopNode", "//PrimaryCmpNode") def m_bytes_literal(char a): @@ -125,6 +143,18 @@ def m_bytes_literal(char a): cdef int result = a in b'ab\0cde\0f\0g' return result +@cython.test_assert_path_exists("//SwitchStatNode") +@cython.test_fail_if_path_exists("//BoolBinopNode", "//PrimaryCmpNode") +def m_bytes_literal_unsigned(unsigned char a): + """ + >>> m_bytes_literal(ord('f')) + 1 + >>> m_bytes_literal(ord('X')) + 0 + """ + cdef int result = a in b'ab\0cde\0f\0g' + return result + cdef unicode unicode_string = u'abc\0defg\u1234\uF8D2' py_unicode_string = unicode_string