MCPcopy Create free account
hub / github.com/casadi/casadi / test_Callback_errors

Method test_Callback_errors

test/python/function.py:1297–1324  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1295
1296
1297 def test_Callback_errors(self):
1298
1299 class Fun(Callback):
1300
1301 def __init__(self):
1302 Callback.__init__(self)
1303 self.construct("Fun", {})
1304 def get_n_in(self): return 2
1305 def get_n_out(self): return 1
1306
1307 def get_sparsity_in(i):
1308 return 4
1309
1310 def eval(self,arg):
1311 x = arg[0]
1312 y = arg[1]
1313
1314 z0 = 3*y
1315 z1 = x+z0
1316 z2 = sin(z1)
1317 return [z2]
1318
1319 try:
1320 f = Fun()
1321 except Exception as e:
1322 s = str(e)
1323 print(s)
1324 self.assertTrue("get_sparsity_in" in s)
1325
1326 def test_Callback(self):
1327

Callers

nothing calls this directly

Calls 3

FunClass · 0.85
strFunction · 0.85
printFunction · 0.50

Tested by

no test coverage detected