def test_hashids_decode_one(): assert hashids.decode_one("foo", "1V91V4") == 1 assert hashids.decode_one("bar", "E8Rz8D") == 1 assert hashids.decode_one("foo", "Lgq4nK") == 123 assert hashids.decode_one("foo", "zvuvt2") is None
def get_by_hashid(cls, hashid): """Return the group with the given hashid, or None.""" return cls.get_by_id(hashids.decode_one('h.groups', hashid))