Skip to content

Commit 3c4d421

Browse files
committed
Added test of Python binding to Spatial Pooler writeToString
1 parent b59f646 commit 3c4d421

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

bindings/py/tests/algorithms/spatial_pooler_test.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,19 @@ def testNupicSpatialPoolerPickling(self):
177177
self.assertEqual(sp.getNumColumns(), sp2.getNumColumns(),
178178
"Simple NuPIC SpatialPooler pickle/unpickle failed.")
179179

180+
def testNupicSpatialPoolerSavingToString(self):
181+
"""Test writing to and reading from NuPIC SpatialPooler."""
182+
183+
# Simple test: make sure that writing/reading works...
184+
sp = SP()
185+
s = sp.writeToString()
186+
187+
sp2 = sp.readFromString(s)
188+
189+
self.assertEqual(sp.getNumColumns(), sp2.getNumColumns(),
190+
"NuPIC SpatialPooler write to/read from string failed.")
191+
192+
180193

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

0 commit comments

Comments
 (0)