Skip to content

Commit

Permalink
pygpu/tests: Do not compare gpudata if the context is not CUDA
Browse files Browse the repository at this point in the history
Fixes #491
v2: Do not skip the entire test
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
  • Loading branch information
jvesely committed Apr 18, 2018
1 parent 5761af1 commit 0c25f2c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pygpu/tests/test_gpu_ndarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def asfortranarray(shp, dtype, offseted_outer, offseted_inner, sliced, order):

# numpy upcast with a view to 1d scalar.
if gpu.flags['F_CONTIGUOUS']:
assert b.gpudata == gpu.gpudata
assert ctx.kind != b'cuda' or b.gpudata == gpu.gpudata
elif (sliced != 1 or shp == () or (offseted_outer and len(shp) > 1) or
(order != 'f' and len(shp) > 1)):
assert b is not gpu
Expand Down Expand Up @@ -286,7 +286,8 @@ def test_mapping_getitem_ellipsis():
def mapping_getitem_ellipsis(shp, dtype, offseted):
a, a_gpu = gen_gpuarray(shp, dtype, offseted, ctx=ctx)
b = a_gpu[...]
assert b.gpudata == a_gpu.gpudata
if ctx.kind == b'cuda':
assert b.gpudata == a_gpu.gpudata
assert b.strides == a.strides
assert b.shape == a.shape
b_cpu = numpy.asarray(b)
Expand Down

0 comments on commit 0c25f2c

Please sign in to comment.