From b5cfad6e4bb445ad7ca2f433c01d51f7401fa257 Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Thu, 22 Apr 2010 15:08:42 +0200 Subject: [PATCH] extended test case --- tests/run/inop.pyx | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) 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 -- 2.26.2