|
|
@@ -79,3 +79,11 @@ def test_zero_tops(self): |
|
|
net_proto = silent_net()
|
|
|
net = self.load_net(net_proto)
|
|
|
self.assertEqual(len(net.forward()), 0)
|
|
|
+
|
|
|
+ def test_type_error(self):
|
|
|
+ """Test that a TypeError is raised when a Function input isn't a Top."""
|
|
|
+ data = L.DummyData(ntop=2) # data is a 2-tuple of Tops
|
|
|
+ r = r"^Silence input 0 is not a Top \(type is <(type|class) 'tuple'>\)$"
|
|
|
+ with self.assertRaisesRegexp(TypeError, r):
|
|
|
+ L.Silence(data, ntop=0) # should raise: data is a tuple, not a Top
|
|
|
+ L.Silence(*data, ntop=0) # shouldn't raise: each elt of data is a Top
|