Skip to content

Commit

Permalink
Add tests for type checks
Browse files Browse the repository at this point in the history
I forgot to commit this file as part of
d3712e0 (PR #289).
  • Loading branch information
jgosmann committed Oct 29, 2021
1 parent 813e57d commit 9a65404
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions nengo_spa/tests/test_typechecks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import numpy as np

from nengo_spa.typechecks import is_integer, is_number


def test_is_integer():
assert is_integer(1)
assert is_integer(np.array(1))
assert not is_integer(np.array([1]))
assert not is_integer(1.0)
assert not is_integer(np.array(1.0))
assert not is_integer(np.array([1.0]))
assert not is_integer(object())


def test_is_number():
assert is_number(1)
assert is_number(np.array(1))
assert is_number(1.0)
assert is_number(np.array(1.0))
assert not is_number(np.array([1.0]))
assert not is_number(np.array([1]))
assert not is_number(object())

0 comments on commit 9a65404

Please sign in to comment.