Exemplo n.º 1
0
def test_complement():
    srca = randomtable(4, 10)
    srcb = randomtable(4, 10)
    tbl = ComplementView(srca, srcb)
    before = tbl.cachetag()
    srca.reseed()
    after = tbl.cachetag()
    assert before != after
Exemplo n.º 2
0
def test_antijoin():
    srca = randomtable(2, 10)
    srcb = randomtable(4, 10)
    tbl = AntiJoinView(srca, srcb, 'f0')
    before = tbl.cachetag()
    srca.reseed()
    after = tbl.cachetag()
    assert before != after
Exemplo n.º 3
0
def test_complement():
    srca = randomtable(4, 10)
    srcb = randomtable(4, 10)
    tbl = ComplementView(srca, srcb)
    before = tbl.cachetag()
    srca.reseed()
    after = tbl.cachetag()
    assert before != after
Exemplo n.º 4
0
def test_implicitjoin():
    srca = randomtable(2, 10)
    srcb = randomtable(4, 10)
    tbl = ImplicitJoinView(srca, srcb)
    before = tbl.cachetag()
    srca.reseed()
    after = tbl.cachetag()
    assert before != after
Exemplo n.º 5
0
def test_antijoin():
    srca = randomtable(2, 10)
    srcb = randomtable(4, 10)
    tbl = AntiJoinView(srca, srcb, 'f0')
    before = tbl.cachetag()
    srca.reseed()
    after = tbl.cachetag()
    assert before != after
Exemplo n.º 6
0
def test_crossjoin():
    srca = randomtable(2, 10)
    srcb = randomtable(4, 10)
    tbl = CrossJoinView(srca, srcb)
    before = tbl.cachetag()
    srca.reseed()
    after = tbl.cachetag()
    assert before != after
Exemplo n.º 7
0
def test_implicitantijoin():
    srca = randomtable(2, 10)
    srcb = randomtable(4, 10)
    tbl = ImplicitAntiJoinView(srca, srcb)
    before = tbl.cachetag()
    srca.reseed()
    after = tbl.cachetag()
    assert before != after
Exemplo n.º 8
0
def test_crossjoin():
    srca = randomtable(2, 10)
    srcb = randomtable(4, 10)
    tbl = CrossJoinView(srca, srcb)
    before = tbl.cachetag()
    srca.reseed()
    after = tbl.cachetag()
    assert before != after
Exemplo n.º 9
0
def test_unpack():
    src = randomtable(2, 10)
    tbl = UnpackView(src, 'f1', newfields=['foo', 'bar'])
    before = tbl.cachetag()
    src.reseed()
    after = tbl.cachetag()
    assert before != after
Exemplo n.º 10
0
def test_skip():
    src = randomtable(2, 10)
    tbl = SkipView(src, 2)
    before = tbl.cachetag()
    src.reseed()
    after = tbl.cachetag()
    assert before != after
Exemplo n.º 11
0
def test_pushheader():
    src = randomtable(2, 10)
    tbl = PushHeaderView(src, ['foo', 'bar'])
    before = tbl.cachetag()
    src.reseed()
    after = tbl.cachetag()
    assert before != after
Exemplo n.º 12
0
def test_cut():
    src = randomtable(4, 10)
    tbl = CutView(src, 'f0', 'f2')
    before = tbl.cachetag()
    src.reseed()
    after = tbl.cachetag()
    assert before != after
Exemplo n.º 13
0
def test_select():
    src = randomtable(4, 10)
    tbl = RowSelectView(src, lambda rec: rec['f0'] > rec['f1'])
    before = tbl.cachetag()
    src.reseed()
    after = tbl.cachetag()
    assert before != after
Exemplo n.º 14
0
def test_cat():
    src = randomtable(4, 10)
    tbl = CatView([src])
    before = tbl.cachetag()
    src.reseed()
    after = tbl.cachetag()
    assert before != after
Exemplo n.º 15
0
def test_rename():
    src = randomtable(2, 10)
    tbl = RenameView(src, {'f0': 'foo', 'f1': 'bar'})
    before = tbl.cachetag()
    src.reseed()
    after = tbl.cachetag()
    assert before != after
Exemplo n.º 16
0
def test_selectf():
    src = randomtable(4, 10)
    tbl = FieldSelectView(src, 'f0', lambda v: v > 0)
    before = tbl.cachetag()
    src.reseed()
    after = tbl.cachetag()
    assert before != after
Exemplo n.º 17
0
def test_rowmap():
    src = randomtable(4, 10)
    tbl = RowMapView(src, lambda row: [row[0] + row[1], row[2]], fields=['foo', 'bar'])
    before = tbl.cachetag()
    src.reseed()
    after = tbl.cachetag()
    assert before != after
Exemplo n.º 18
0
def test_recast():
    src = randomtable(4, 10)
    tbl = RecastView(src, variablefield='f1', valuefield='f2')
    before = tbl.cachetag()
    src.reseed()
    after = tbl.cachetag()
    assert before != after
Exemplo n.º 19
0
def test_split():
    src = randomtable(4, 10)
    tbl = SplitView(src, 'f0', 'foo', newfields=('a', 'b'))
    before = tbl.cachetag()
    src.reseed()
    after = tbl.cachetag()
    assert before != after
Exemplo n.º 20
0
def test_melt():
    src = randomtable(4, 10)
    tbl = MeltView(src, key='f0')
    before = tbl.cachetag()
    src.reseed()
    after = tbl.cachetag()
    assert before != after
Exemplo n.º 21
0
def test_selectf():
    src = randomtable(4, 10)
    tbl = FieldSelectView(src, 'f0', lambda v: v > 0)
    before = tbl.cachetag()
    src.reseed()
    after = tbl.cachetag()
    assert before != after
Exemplo n.º 22
0
def test_select():
    src = randomtable(4, 10)
    tbl = RowSelectView(src, lambda rec: rec['f0'] > rec['f1'])
    before = tbl.cachetag()
    src.reseed()
    after = tbl.cachetag()
    assert before != after
Exemplo n.º 23
0
def test_rename():
    src = randomtable(2, 10)
    tbl = RenameView(src, {'f0': 'foo', 'f1': 'bar'})
    before = tbl.cachetag()
    src.reseed()
    after = tbl.cachetag()
    assert before != after
Exemplo n.º 24
0
def test_tail():
    src = randomtable(2, 10)
    tbl = TailView(src, 3)
    before = tbl.cachetag()
    src.reseed()
    after = tbl.cachetag()
    assert before != after
Exemplo n.º 25
0
def test_skip():
    src = randomtable(2, 10)
    tbl = SkipView(src, 2)
    before = tbl.cachetag()
    src.reseed()
    after = tbl.cachetag()
    assert before != after
Exemplo n.º 26
0
def test_duplicates():
    src = randomtable(4, 10)
    tbl = DuplicatesView(src, key='f0')
    before = tbl.cachetag()
    src.reseed()
    after = tbl.cachetag()
    assert before != after
Exemplo n.º 27
0
def test_conflicts():
    src = randomtable(4, 10)
    tbl = ConflictsView(src, key='f0')
    before = tbl.cachetag()
    src.reseed()
    after = tbl.cachetag()
    assert before != after
Exemplo n.º 28
0
def test_duplicates():
    src = randomtable(4, 10)
    tbl = DuplicatesView(src, key='f0')
    before = tbl.cachetag()
    src.reseed()
    after = tbl.cachetag()
    assert before != after
Exemplo n.º 29
0
def test_sort():
    src = randomtable(2, 10)
    tbl = SortView(src)
    before = tbl.cachetag()
    src.reseed()
    after = tbl.cachetag()
    assert before != after
Exemplo n.º 30
0
def test_melt():
    src = randomtable(4, 10)
    tbl = MeltView(src, key='f0')
    before = tbl.cachetag()
    src.reseed()
    after = tbl.cachetag()
    assert before != after
Exemplo n.º 31
0
def test_recast():
    src = randomtable(4, 10)
    tbl = RecastView(src, variablefield='f1', valuefield='f2')
    before = tbl.cachetag()
    src.reseed()
    after = tbl.cachetag()
    assert before != after
Exemplo n.º 32
0
def test_sort():
    src = randomtable(2, 10)
    tbl = SortView(src)
    before = tbl.cachetag()
    src.reseed()
    after = tbl.cachetag()
    assert before != after
Exemplo n.º 33
0
def test_tail():
    src = randomtable(2, 10)
    tbl = TailView(src, 3)
    before = tbl.cachetag()
    src.reseed()
    after = tbl.cachetag()
    assert before != after
Exemplo n.º 34
0
def test_rowslice():
    src = randomtable(2, 10)
    tbl = RowSliceView(src, 1, 3)
    before = tbl.cachetag()
    src.reseed()
    after = tbl.cachetag()
    assert before != after
Exemplo n.º 35
0
def test_rowslice():
    src = randomtable(2, 10)
    tbl = RowSliceView(src, 1, 3)
    before = tbl.cachetag()
    src.reseed()
    after = tbl.cachetag()
    assert before != after
Exemplo n.º 36
0
def test_split():
    src = randomtable(4, 10)
    tbl = SplitView(src, 'f0', 'foo', newfields=('a', 'b'))
    before = tbl.cachetag()
    src.reseed()
    after = tbl.cachetag()
    assert before != after
Exemplo n.º 37
0
def test_pushheader():
    src = randomtable(2, 10)
    tbl = PushHeaderView(src, ['foo', 'bar'])
    before = tbl.cachetag()
    src.reseed()
    after = tbl.cachetag()
    assert before != after
Exemplo n.º 38
0
def test_cut():
    src = randomtable(4, 10)
    tbl = CutView(src, 'f0', 'f2')
    before = tbl.cachetag()
    src.reseed()
    after = tbl.cachetag()
    assert before != after
Exemplo n.º 39
0
def test_conflicts():
    src = randomtable(4, 10)
    tbl = ConflictsView(src, key='f0')
    before = tbl.cachetag()
    src.reseed()
    after = tbl.cachetag()
    assert before != after
Exemplo n.º 40
0
def test_unpack():
    src = randomtable(2, 10)
    tbl = UnpackView(src, 'f1', newfields=['foo', 'bar'])
    before = tbl.cachetag()
    src.reseed()
    after = tbl.cachetag()
    assert before != after
Exemplo n.º 41
0
def test_cat():
    src = randomtable(4, 10)
    tbl = CatView([src])
    before = tbl.cachetag()
    src.reseed()
    after = tbl.cachetag()
    assert before != after
Exemplo n.º 42
0
def test_addfield():
    src = randomtable(2, 10)
    tbl = AddFieldView(src, 'ext', lambda rec: rec['f0'] + rec['f1'])
    before = tbl.cachetag()
    src.reseed()
    after = tbl.cachetag()
    assert before != after
Exemplo n.º 43
0
def test_addfield():
    src = randomtable(2, 10)
    tbl = AddFieldView(src, 'ext', lambda rec: rec['f0'] + rec['f1'])
    before = tbl.cachetag()
    src.reseed()
    after = tbl.cachetag()
    assert before != after
Exemplo n.º 44
0
def test_rowreduce():
    src = randomtable(4, 10)
    redu = lambda key, rows: [key, sum([r[1] for r in rows])]
    tbl = RowReduceView(src, key='f0', reducer=redu, fields=['key', 'sum'])
    before = tbl.cachetag()
    src.reseed()
    after = tbl.cachetag()
    assert before != after
Exemplo n.º 45
0
def test_fieldconvert():
    src = randomtable(4, 10)
    converters = {'f0': int, 'f1': {'foo': 'bar'}, 'f2': ['replace', 'a', 'aa']}
    tbl = FieldConvertView(src, converters)
    before = tbl.cachetag()
    src.reseed()
    after = tbl.cachetag()
    assert before != after
Exemplo n.º 46
0
def test_rowreduce():
    src = randomtable(4, 10)
    redu = lambda key, rows: [key, sum([r[1] for r in rows])]
    tbl = RowReduceView(src, key='f0', reducer=redu, fields=['key', 'sum'])
    before = tbl.cachetag()
    src.reseed()
    after = tbl.cachetag()
    assert before != after
Exemplo n.º 47
0
def test_rangerowreduce():
    src = randomtable(4, 10)
    redu = lambda minv, maxv, rows: [minv, maxv, sum([r[1] for r in rows])]
    tbl = RangeRowReduceView(src, 'f0', 0.2, reducer=redu, fields=['min', 'max', 'sum'])
    before = tbl.cachetag()
    src.reseed()
    after = tbl.cachetag()
    assert before != after
Exemplo n.º 48
0
def test_rowmapmany():
    src = randomtable(4, 10)
    def mapf(row):
        yield [row[0] + row[1], row[2]]
    tbl = RowMapManyView(src, mapf, fields=['foo', 'bar'])
    before = tbl.cachetag()
    src.reseed()
    after = tbl.cachetag()
    assert before != after
Exemplo n.º 49
0
def test_rowmap():
    src = randomtable(4, 10)
    tbl = RowMapView(src,
                     lambda row: [row[0] + row[1], row[2]],
                     fields=['foo', 'bar'])
    before = tbl.cachetag()
    src.reseed()
    after = tbl.cachetag()
    assert before != after
Exemplo n.º 50
0
def test_rangeaggregate():
    src = randomtable(4, 10)
    tbl = RangeAggregateView(src, 'f0', 0.2)
    tbl['a1'] = 'f1', sum
    tbl['a2'] = 'f2', max
    tbl['a3'] = 'f3'
    before = tbl.cachetag()
    src.reseed()
    after = tbl.cachetag()
    assert before != after
Exemplo n.º 51
0
def test_rangeaggregate():
    src = randomtable(4, 10)
    tbl = RangeAggregateView(src, 'f0', 0.2)
    tbl['a1'] = 'f1', sum
    tbl['a2'] = 'f2', max
    tbl['a3'] = 'f3'
    before = tbl.cachetag()
    src.reseed()
    after = tbl.cachetag()
    assert before != after
Exemplo n.º 52
0
def test_fieldmap():
    src = randomtable(4, 10)
    tbl = FieldMapView(src)
    tbl['F0'] = 'f0'
    tbl['F1'] = 'f1', {True: False, False: True}
    tbl['F2'] = 'f2', lambda v: v**2
    tbl['F3'] = lambda rec: rec['f0'] * rec['f1']
    before = tbl.cachetag()
    src.reseed()
    after = tbl.cachetag()
    assert before != after
Exemplo n.º 53
0
def test_fieldmap():
    src = randomtable(4, 10)
    tbl = FieldMapView(src)
    tbl['F0'] = 'f0'
    tbl['F1'] = 'f1', {True: False, False: True}
    tbl['F2'] = 'f2', lambda v: v**2
    tbl['F3'] = lambda rec: rec['f0'] * rec['f1']
    before = tbl.cachetag()
    src.reseed()
    after = tbl.cachetag()
    assert before != after
Exemplo n.º 54
0
def test_rowmapmany():
    src = randomtable(4, 10)

    def mapf(row):
        yield [row[0] + row[1], row[2]]

    tbl = RowMapManyView(src, mapf, fields=['foo', 'bar'])
    before = tbl.cachetag()
    src.reseed()
    after = tbl.cachetag()
    assert before != after
Exemplo n.º 55
0
def test_rangerowreduce():
    src = randomtable(4, 10)
    redu = lambda minv, maxv, rows: [minv, maxv, sum([r[1] for r in rows])]
    tbl = RangeRowReduceView(src,
                             'f0',
                             0.2,
                             reducer=redu,
                             fields=['min', 'max', 'sum'])
    before = tbl.cachetag()
    src.reseed()
    after = tbl.cachetag()
    assert before != after
Exemplo n.º 56
0
def test_fieldconvert():
    src = randomtable(4, 10)
    converters = {
        'f0': int,
        'f1': {
            'foo': 'bar'
        },
        'f2': ['replace', 'a', 'aa']
    }
    tbl = FieldConvertView(src, converters)
    before = tbl.cachetag()
    src.reseed()
    after = tbl.cachetag()
    assert before != after