Exemple #1
0
def test_resolver_resolve_expression(patch):
    patch.object(Resolver, 'expression')
    item = {'$OBJECT': 'expression', 'expression': '==', 'values': []}
    result = Resolver.resolve(item, 'data')
    Resolver.expression.assert_called_with('data', item['expression'],
                                           item['values'])
    assert result == Resolver.expression()
Exemple #2
0
def test_resolver_expression(patch):
    patch.object(Resolver, 'values', return_value=[1])
    patch.object(Resolver, 'stringify', return_value='1')
    result = Resolver.expression('data', '{} == 1', 'values')
    Resolver.values.assert_called_with('values', data='data')
    Resolver.stringify.assert_called_with(1)
    assert result