def test_alphabet(self): backup_alphabet = get_alphabet() alphabet = "01" set_alphabet(alphabet) self.assertEqual(alphabet, get_alphabet()) set_alphabet("01010101010101") self.assertEqual(alphabet, get_alphabet()) self.assertEqual(set(uuid()), set("01")) self.assertTrue(116 < len(uuid()) < 140) ui = uuid4() self.assertEqual(ui, decode(encode(ui))) ui = uuid() self.assertEqual(ui, encode(decode(ui))) self.assertRaises(ValueError, set_alphabet, "1") self.assertRaises(ValueError, set_alphabet, "1111111") set_alphabet(backup_alphabet) self.assertRaises(ValueError, lambda x: ShortUUID(x), "0")
def test_alphabet(self): backup_alphabet = get_alphabet() alphabet = "01" set_alphabet(alphabet) self.assertEqual(alphabet, get_alphabet()) set_alphabet("01010101010101") self.assertEqual(alphabet, get_alphabet()) self.assertEqual(set(uuid()), set("01")) self.assertTrue(116 < len(uuid()) < 140) u = uuid4() self.assertEqual(u, decode(encode(u))) u = uuid() self.assertEqual(u, encode(decode(u))) self.assertRaises(ValueError, set_alphabet, "1") self.assertRaises(ValueError, set_alphabet, "1111111") set_alphabet(backup_alphabet) self.assertRaises(ValueError, lambda x: ShortUUID(x), "0")
def test_encoding(self): ui = UUID("{3b1f8b40-222c-4a6e-b77e-779d5a94e21c}") self.assertEqual(encode(ui), "bYRT25J5s7Bniqr4b58cXC")
def test_encoding(self): u = UUID("{3b1f8b40-222c-4a6e-b77e-779d5a94e21c}") self.assertEqual(encode(u), "CXc85b4rqinB7s5J52TRYb")