extended test case
authorStefan Behnel <scoder@users.berlios.de>
Thu, 22 Apr 2010 13:08:42 +0000 (15:08 +0200)
committerStefan Behnel <scoder@users.berlios.de>
Thu, 22 Apr 2010 13:08:42 +0000 (15:08 +0200)
tests/run/inop.pyx

index b2d7733a59f2b330e378b4c79f27b88d63a6e3d6..917eff714c1fc23827926050f41b6ab77e428950 100644 (file)
@@ -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