def do_test(self, k): packed = keylib.packs(k) try: unpacked = keylib.unpack(packed) eq(k, keylib.unpack(keylib.packs(k))) except: print 'failing enc was: %r' % (packed,) raise
def do_test(self, k): packed = keylib.packs('', k) try: unpacked = keylib.unpack('', packed) eq(k, keylib.unpack('', keylib.packs('', k))) except: print 'failing enc was: %r' % (packed,) raise
def test1(self): for i in self.INTS: s = keylib.packs('', i) try: j, = keylib.unpack('', s) eq(j, i) except: print [i, s] raise
def test1(self): for i in self.INTS: s = keylib.packs(i) try: j, = keylib.unpack(s) eq(j, i) except: print [i, s] raise
def test_minusone(self): tz = dateutil.tz.gettz('Etc/GMT-1') dt = self._now_truncate(tz) s = keylib.packs('', dt) dt2, = keylib.unpack('', s) eq(dt, dt2)
def test_utc(self): tz = dateutil.tz.gettz('Etc/UTC') dt = self._now_truncate(tz) s = keylib.packs('', dt) dt2, = keylib.unpack('', s) eq(dt, dt2)
def test_naive(self): dt = self._now_truncate() s = keylib.packs('', dt) dt2, = keylib.unpack('', s) eq(dt.utctimetuple(), dt2.utctimetuple())
def testUuid(self): t = ('a', uuid.uuid4(), 'b') s = keylib.packs('', t) eq(t, keylib.unpack('', s))
def testStringSorting(self): strs = [(x,) for x in ('dave', 'dave\x00', 'dave\x01', 'davee\x01')] encs = map(lambda o: keylib.packs('', o), strs) encs.sort() eq(strs, [keylib.unpack('', x) for x in encs])
def assertOrder(self, tups): tups = map(keylib.Key, tups) encs = map(keylib.packs, tups) encs.sort() eq(tups, [keylib.unpack(x) for x in encs])
def test_minusone(self): tz = dateutil.tz.gettz('Etc/GMT-1') dt = self._now_truncate(tz) s = keylib.packs(dt) dt2, = keylib.unpack(s) eq(dt, dt2)
def test_utc(self): tz = dateutil.tz.gettz('Etc/UTC') dt = self._now_truncate(tz) s = keylib.packs(dt) dt2, = keylib.unpack(s) eq(dt, dt2)
def test_naive(self): dt = self._now_truncate() s = keylib.packs(dt) dt2, = keylib.unpack(s) eq(dt.utctimetuple(), dt2.utctimetuple())
def testUuid(self): t = ('a', uuid.uuid4(), 'b') s = keylib.packs(t) eq(t, keylib.unpack(s))
def testStringSorting(self): strs = [(x,) for x in ('dave', 'dave\x00', 'dave\x01', 'davee\x01')] encs = map(lambda o: keylib.packs(o), strs) encs.sort() eq(strs, [keylib.unpack(x) for x in encs])