示例#1
0
    def test_tobcolz():
        t = [('foo', 'bar', 'baz'), ('apples', 1, 2.5), ('oranges', 3, 4.4),
             ('pears', 7, .1)]

        ctbl = tobcolz(t)
        assert isinstance(ctbl, bcolz.ctable)
        eq_(t[0], tuple(ctbl.names))
        ieq(t[1:], (tuple(r) for r in ctbl.iter()))

        ctbl = tobcolz(t, chunklen=2)
        assert isinstance(ctbl, bcolz.ctable)
        eq_(t[0], tuple(ctbl.names))
        ieq(t[1:], (tuple(r) for r in ctbl.iter()))
        eq_(2, ctbl.cols[ctbl.names[0]].chunklen)
示例#2
0
    def test_tobcolz():
        t = [('foo', 'bar', 'baz'),
             ('apples', 1, 2.5),
             ('oranges', 3, 4.4),
             ('pears', 7, .1)]

        ctbl = tobcolz(t)
        assert isinstance(ctbl, bcolz.ctable)
        eq_(t[0], tuple(ctbl.names))
        ieq(t[1:], (tuple(r) for r in ctbl.iter()))

        ctbl = tobcolz(t, chunklen=2)
        assert isinstance(ctbl, bcolz.ctable)
        eq_(t[0], tuple(ctbl.names))
        ieq(t[1:], (tuple(r) for r in ctbl.iter()))
        eq_(2, ctbl.cols[ctbl.names[0]].chunklen)
示例#3
0
    def test_appendbcolz():
        t = [('foo', 'bar', 'baz'), ('apples', 1, 2.5), ('oranges', 3, 4.4),
             ('pears', 7, .1)]

        # append to in-memory ctable
        ctbl = tobcolz(t)
        appendbcolz(t, ctbl)
        eq_(t[0], tuple(ctbl.names))
        ieq(t[1:] + t[1:], (tuple(r) for r in ctbl.iter()))

        # append to on-disk ctable
        rootdir = tempfile.mkdtemp()
        tobcolz(t, rootdir=rootdir)
        appendbcolz(t, rootdir)
        ctbl = bcolz.open(rootdir, mode='r')
        eq_(t[0], tuple(ctbl.names))
        ieq(t[1:] + t[1:], (tuple(r) for r in ctbl.iter()))
示例#4
0
    def test_appendbcolz():
        t = [('foo', 'bar', 'baz'),
             ('apples', 1, 2.5),
             ('oranges', 3, 4.4),
             ('pears', 7, .1)]

        # append to in-memory ctable
        ctbl = tobcolz(t)
        appendbcolz(t, ctbl)
        eq_(t[0], tuple(ctbl.names))
        ieq(t[1:] + t[1:], (tuple(r) for r in ctbl.iter()))

        # append to on-disk ctable
        rootdir = tempfile.mkdtemp()
        tobcolz(t, rootdir=rootdir)
        appendbcolz(t, rootdir)
        ctbl = bcolz.open(rootdir, mode='r')
        eq_(t[0], tuple(ctbl.names))
        ieq(t[1:] + t[1:], (tuple(r) for r in ctbl.iter()))