3afe025862c376b13fb0f018d2f6b60ea85f3bcb
[cython.git] / tests / errors / py_unicode_type_errors.pyx
1 # -*- coding: iso-8859-1 -*-
2
3 cdef Py_UNICODE char_ASCII = u'A'
4 cdef Py_UNICODE char_KLINGON = u'\uF8D2'
5
6 def char_too_long_ASCII():
7     cdef Py_UNICODE c = u'AB'
8
9 def char_too_long_Unicode():
10     cdef Py_UNICODE c = u'A\uF8D2'
11
12 def char_too_long_bytes():
13     cdef Py_UNICODE c = b'AB'
14
15 def char_too_long_latin1():
16     cdef Py_UNICODE char_bytes_latin1 = b'\xf6'
17
18
19 _ERRORS = """
20 7:24: Only single-character Unicode string literals can be coerced into Py_UNICODE.
21 10:24: Only single-character Unicode string literals can be coerced into Py_UNICODE.
22 13:24: Only single-character string literals can be coerced into ints.
23 16:40: Bytes literals cannot coerce to Py_UNICODE, use a unicode literal instead.
24 """