Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
41f1d2e6
Commit
41f1d2e6
authored
Oct 19, 2018
by
Андрей Парамонов
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix tests on Python 2 -- attempt 3
parent
5e15c4e3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
8 deletions
+13
-8
tests/memoryview/memoryview.pyx
tests/memoryview/memoryview.pyx
+13
-8
No files found.
tests/memoryview/memoryview.pyx
View file @
41f1d2e6
...
...
@@ -1089,20 +1089,25 @@ def optimised_index_of_slice(int[:,:,:] arr, int x, int y, int z):
def
test_assign_from_byteslike
(
byteslike
):
# Once http://python3statement.org is accepted, should be just
# >>> test_assign_from_byteslike(bytes(b'hello'))
# b'hello'
# ...
"""
>>>
test_assign_from_byteslike(bytes(b'hello')) == b'hello'
True
>>>
test_assign_from_byteslike(bytearray(b'howdy')) == b'howdy'
True
>>>
print(test_assign_from_byteslike(bytes(b'hello')).decode())
hello
>>>
print(test_assign_from_byteslike(bytearray(b'howdy')).decode())
howdy
"""
# fails on Python 2.7- with
# TypeError: an integer is required
# >>>
test_assign_from_byteslike(pyarray.array('B', b'aloha')) == b'aloha'
#
True
# >>>
print(test_assign_from_byteslike(pyarray.array('B', b'aloha')).decode())
#
aloha
# fails on Python 2.6- with
# NameError: name 'memoryview' is not defined
# >>> test_assign_from_byteslike(memoryview(b'bye!!')) == b'bye!!'
# True
# >>> print(test_assign_from_byteslike(memoryview(b'bye!!')).decode())
# bye!!
def
assign
(
m
):
m
[:]
=
byteslike
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment