def test_iter_synapses(self): _, _, syn_matrix = utils.iter_columns(self.columns).next() inst = utils.iter_synapses(syn_matrix) self.assertIsInstance(inst, types.GeneratorType) for y, x, perm in inst: self.assertIsInstance(y, types.IntType) self.assertIn(y, (0, 1)) self.assertIsInstance(x, types.IntType) self.assertIn(x, (0, 1)) self.assertIsInstance(perm, types.FloatType)
def test_iter_columns(self): inst = utils.iter_columns(self.columns) self.assertIsInstance(inst, types.GeneratorType) for y, x, syn_matrix in inst: self.assertIsInstance(y, types.IntType) self.assertIn(y, (0, 1)) self.assertIsInstance(x, types.IntType) self.assertIn(x, (0, 1)) self.assertIsInstance(syn_matrix, np.ndarray) self.assertEqual(syn_matrix.shape, (2, 2))