Example #1
0
def test_get_column():
    nt = NTuple('A', 'B')
    for x in range(100):
        nt.fill('A', x)
        nt.fill('B', x * 100)
        nt.write()
    A = nt.column('A')
    assert A == range(100)
    B = nt.column('B')
    assert B == [x * 100 for x in range(100)]
Example #2
0
def test_get_with_cross_cut():
    nt = NTuple('A', 'B')
    for x in range(100):
        nt.fill('A', x)
        nt.fill('B', x * 100)
        nt.write()
    col = nt.column('B', lambda x: x.A > 50 and x.B < 8500)
    assert col == [x * 100 for x in xrange(51, 85)]
Example #3
0
def test_get_with_cut():
    nt = NTuple('A', 'B')
    for x in range(100):
        nt.fill('A', x)
        nt.fill('B', x * 100)
        nt.write()
    col = nt.column('A', lambda x: x.A > 50)
    assert col == range(51, 100)