Commit 62be0f9a authored by Stefan Behnel's avatar Stefan Behnel

Py3 test fix

parent 3c0b5948
...@@ -5,13 +5,16 @@ cdef bytes b12345 = b'12345' ...@@ -5,13 +5,16 @@ cdef bytes b12345 = b'12345'
def index_literal(int i): def index_literal(int i):
""" """
>>> index_literal(0) == '1'.encode('ASCII') Python 3 returns integer values on indexing, Py2 returns byte
string literals...
>>> index_literal(0) in (ord('1'), '1')
True True
>>> index_literal(-5) == '1'.encode('ASCII') >>> index_literal(-5) in (ord('1'), '1')
True True
>>> index_literal(2) == '3'.encode('ASCII') >>> index_literal(2) in (ord('3'), '3')
True True
>>> index_literal(4) == '5'.encode('ASCII') >>> index_literal(4) in (ord('5'), '5')
True True
""" """
return b"12345"[i] return b"12345"[i]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment