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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cython
Commits
e23836d3
Commit
e23836d3
authored
Oct 23, 2018
by
telamonian
Committed by
Stefan Behnel
Sep 10, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added unit test for bool dtype
parent
c5895c6d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
0 deletions
+14
-0
.gitignore
.gitignore
+5
-0
tests/run/numpy_test.pyx
tests/run/numpy_test.pyx
+9
-0
No files found.
.gitignore
View file @
e23836d3
...
...
@@ -36,3 +36,8 @@ TAGS
MANIFEST
.tox
# Jetbrains IDE project files
/.idea
/*.iml
tests/run/numpy_test.pyx
View file @
e23836d3
...
...
@@ -134,6 +134,7 @@ try:
...
ValueError: ndarray is not C...contiguous
>>> test_dtype('?', inc1_bool)
>>> test_dtype('b', inc1_byte)
>>> test_dtype('B', inc1_ubyte)
>>> test_dtype('h', inc1_short)
...
...
@@ -340,6 +341,7 @@ def test_f_contig(np.ndarray[int, ndim=2, mode='fortran'] arr):
print u" ".join([unicode(arr[i, j]) for j in range(arr.shape[1])])
# Exhaustive dtype tests -- increments element [1] by 1 (or 1+1j) for all dtypes
def inc1_bool(np.ndarray[unsigned char] arr): arr[1] += 1
def inc1_byte(np.ndarray[char] arr): arr[1] += 1
def inc1_ubyte(np.ndarray[unsigned char] arr): arr[1] += 1
def inc1_short(np.ndarray[short] arr): arr[1] += 1
...
...
@@ -402,6 +404,13 @@ def test_dtype(dtype, inc1):
a = np.array([0, 10+10j], dtype=dtype)
inc1(a)
if a[1] != (11 + 11j): print u"failed!", a[1]
elif dtype == '
?
':
# bool ndarrays coerce all values to 0 or 1
a = np.array([0, 0], dtype=dtype)
inc1(a)
if a[1] != 1: print u"failed!"
inc1(a)
if a[1] != 1: print u"failed!"
else:
a = np.array([0, 10], dtype=dtype)
inc1(a)
...
...
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