def test_max_int(self): encoded = short_id.encode(short_id.MAX_ID) if short_id.DATASTORE_BITS == 128: self.assertEquals(encoded, 'F=_g') elif short_id.DATASTORE_BITS == 64: self.assertEquals(encoded, '7=_A') else: self.fail("number of bits in a datastore id is not an expected value (64 or 128")
def test_max_int(self): encoded = short_id.encode(short_id.MAX_ID) if short_id.DATASTORE_BITS == 128: self.assertEquals(encoded, 'F=_g') elif short_id.DATASTORE_BITS == 64: self.assertEquals(encoded, '7=_A') else: self.fail( "number of bits in a datastore id is not an expected value (64 or 128" )
def test_reject_number_too_long(self): x = short_id.encode(short_id.MAX_ID) + '0' with self.assertRaises(DecodeError) as cm: short_id.decode(x) e = cm.exception self.assertEqual(e.code, DecodeError.OVERFLOW)
def test_decode_max_int(self): x = short_id.decode(short_id.encode(short_id.MAX_ID)) self.assertEquals(short_id.MAX_ID, x)
def test__zero(self): x = short_id.decode(short_id.encode(0)) self.assertEquals(0, x) self.assertEqual(int, x.__class__)
def test_encode_max_numeral(self): s = short_id.encode(short_id.NUMERAL_RADIX - 1) self.assertEquals(s, short_id.NUMERAL[-1])
def test_encode_zero(self): self.assertEquals(short_id.encode(0), '0')