Пример #1
0
 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'})")
Пример #2
0
 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'})")
Пример #3
0
    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)
Пример #4
0
    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)