Skip to content

Commit

Permalink
test: Add uuidgen unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
justiceHui committed Aug 21, 2023
1 parent f2660b6 commit cfba115
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions test/core/uuidgen_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import pytest

import polytope.core.uuidgen as uuidgen


def test_uuid():
assert len(uuidgen.uuid('abcde', 3)) == 3

gen = uuidgen.PolytopeUUID(alphabet='abcde', length=15)
assert gen.alphabet == 'abcde'
assert gen.length == 15

gen.length = 5
uuid = gen.uuid()
assert len(uuid) == 5
for c in uuid:
assert c in gen.alphabet

gen = uuidgen.PolytopeUUID()
assert len(gen.alphabet) == 32
assert gen.length == 8

0 comments on commit cfba115

Please sign in to comment.