def test_sym_call(self): expr = sym_call( 'func', Symbol('some_symbol'), 'arg1', 'arg2', kwarg_name='kwarg value') self.assertEqual( repr(expr), "'func'(*(Symbol('some_symbol'), 'arg1', 'arg2'), " + "**{'kwarg_name': 'kwarg value'})")
def test_sym_call(self): expr = sym_call('func', Symbol('some_symbol'), 'arg1', 'arg2', kwarg_name='kwarg value') self.assertEqual( repr(expr), "'func'(*(Symbol('some_symbol'), 'arg1', 'arg2'), " + "**{'kwarg_name': 'kwarg value'})")
def test_pythagoras(self): from math import sqrt X = Symbol('X') Y = Symbol('Y') expr = sym_call(sqrt, X**2 + Y**2) func = to_callable(expr) self.assertEqual(func(X=3, Y=4), 5)
def test_pythagoras(self): from math import sqrt X = Symbol('X') Y = Symbol('Y') expr = sym_call(sqrt, X ** 2 + Y ** 2) func = to_callable(expr) self.assertEqual(func(X=3, Y=4), 5)