Skip to content

Commit

Permalink
TST: use previous array test
Browse files Browse the repository at this point in the history
  • Loading branch information
tupui committed May 4, 2023
1 parent 4eb945c commit 9507a42
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tests/test_array_namespace.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,22 @@ def test_array_namespace(library, api_version):

def test_array_namespace_errors():
pytest.raises(TypeError, lambda: array_namespace([1]))
pytest.raises(TypeError, lambda: array_namespace([1, 2]))
pytest.raises(TypeError, lambda: array_namespace())

import numpy as np
import torch
x = np.asarray([1, 2])

pytest.raises(TypeError, lambda: array_namespace((x, x)))
pytest.raises(TypeError, lambda: array_namespace(x, (x, x)))

import torch
y = torch.asarray([1, 2])

pytest.raises(TypeError, lambda: array_namespace(x, y))

pytest.raises(ValueError, lambda: array_namespace(x, api_version='2022.12'))


def test_get_namespace():
# Backwards compatible wrapper
assert array_api_compat.get_namespace is array_api_compat.array_namespace

0 comments on commit 9507a42

Please sign in to comment.