import datashape
from blaze.expr import TableSymbol, like, Like


def test_like():
    t = TableSymbol('t', '{name: string, amount: int, city: string}')

    expr = like(t, name='Alice*')

    assert eval(str(expr)).isidentical(expr)
    assert expr.schema == t.schema
    assert expr.dshape[0] == datashape.var

import datashape
import pytest
from datashape import dshape

from blaze import symbol


@pytest.mark.parametrize(
    'ds',
    [
        'var * {name: string}',
        'var * {name: ?string}',
        'var * string',
        'var * ?string',
        'string',
    ]
)
def test_like(ds):
    t = symbol('t', ds)
    expr = getattr(t, 'name', t).like('Alice*')
    assert expr.pattern == 'Alice*'
    assert expr.schema.measure == dshape(
        '%sbool' % ('?' if '?' in ds else '')
    ).measure

Test for new like expression
Test for new like expression
