Example #1
0
def test_serialize_unserialize_is_identity():
    e = event.Event("foobar", random.random(), random.randint(0, 86400))
    (k, v) = marshall.serialize_event(e, epoch=1970)
    e1 = marshall.unserialize_event("foobar", k, v, epoch=1970)
    eq_(e.name(), e1.name())
    eq_(e.unixtimestamp(), e1.unixtimestamp())
    eq_(e.timestamp(), e1.timestamp())
    eq_(e.value(), e1.value())
Example #2
0
def test_serialize_unserialize_is_identity():
    e = event.Event("foobar", random.random(), random.randint(0, 86400))
    (k, v) = marshall.serialize_event(e, epoch=1970)
    e1 = marshall.unserialize_event("foobar", k, v, epoch=1970)
    eq_(e.name(), e1.name())
    eq_(e.unixtimestamp(), e1.unixtimestamp())
    eq_(e.timestamp(), e1.timestamp())
    eq_(e.value(), e1.value())
Example #3
0
def unserialize_event(k, cols):
    f = lambda col: marshall.unserialize_event(k,
                                               struct.unpack(">i", col.column.name)[0],
                                               struct.unpack(">d", col.column.value)[0],
                                               marshall.DEFAULT_EPOCH)
    return(map(f, cols))