Skip to content
This repository has been archived by the owner on Sep 1, 2023. It is now read-only.

Commit

Permalink
Issue #1380: Update SP parameter validation test checking array dimen…
Browse files Browse the repository at this point in the history
…sions
  • Loading branch information
lscheinkman committed Jan 16, 2018
1 parent e470860 commit 38e4026
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/unit/nupic/algorithms/spatial_pooler_cpp_unit_test.py
Expand Up @@ -183,19 +183,33 @@ def testComputeParametersValidation(self):
inputGood = np.ones(5, dtype=uintDType)
outGood = np.zeros(5, dtype=uintDType)
inputBad = np.ones(5, dtype=realDType)
inputBad2D = np.ones((5, 5), dtype=realDType)
outBad = np.zeros(5, dtype=realDType)
outBad2D = np.zeros((5, 5), dtype=realDType)

# Validate good parameters
sp.compute(inputGood, False, outGood)

# Validate bad parameters
with self.assertRaises(RuntimeError):
sp.compute(inputBad, False, outBad)

# Validate bad input
with self.assertRaises(RuntimeError):
sp.compute(inputBad, False, outGood)

# Validate bad 2d input
with self.assertRaises(RuntimeError):
sp.compute(inputBad2D, False, outGood)

# Validate bad output
with self.assertRaises(RuntimeError):
sp.compute(inputGood, False, outBad)

# Validate bad 2d output
with self.assertRaises(RuntimeError):
sp.compute(inputGood, False, outBad2D)


if __name__ == "__main__":
unittest.main()

0 comments on commit 38e4026

Please sign in to comment.