Exemplo n.º 1
0
def test_discover_after_read(engine):
    source = ElasticSearchTableSource('score:[0 TO 150]', **CONNECT)
    info = source.discover()
    dt = {k: str(v) for k, v in df.dtypes.to_dict().items()}
    assert info['dtype'] == dt
    assert info['shape'] == (None, 3)
    assert info['npartitions'] == 1

    out = source.read()
    assert all([d in out.to_dict(orient='records')
               for d in df.to_dict(orient='records')])

    info = source.discover()
    assert info['dtype'] == dt
    assert info['shape'] == (4, 3)
    assert info['npartitions'] == 1
Exemplo n.º 2
0
def test_discover(engine):
    source = ElasticSearchTableSource('score:[30 TO 150]', **CONNECT)
    info = source.discover()
    # NB: ES results come as dicts, so column order can vary
    assert info['dtype'] == {k: str(v) for k, v
                             in df[:0].dtypes.to_dict().items()}
    assert info['shape'] == (None, 3)
    assert info['npartitions'] == 1