Exemple #1
0
def test_make_id_unique():
    length, count = 6, 10000
    ids = set(make_id(length) for i in range_type(count))
    # if we did not encounter duplicates, set size must be <count>
    # of course, in extremely rare cases, this test might fail
    assert len(ids) == count
Exemple #2
0
def test_make_id_length():
    for length in range_type(10):
        assert len(make_id(length)) == length
Exemple #3
0
def test_make_id_alphabet():
    # id must contain alphabet chars ONLY
    assert set(make_id(10, alphabet="abc")) <= set(['a', 'b', 'c'])
Exemple #4
0
def test_make_id_type():
    assert isinstance(make_id(2), str)
def test_make_id_unique():
    length, count = 6, 10000
    ids = set(make_id(length) for i in range_type(count))
    # if we did not encounter duplicates, set size must be <count>
    # of course, in extremely rare cases, this test might fail
    assert len(ids) == count
def test_make_id_alphabet():
    # id must contain alphabet chars ONLY
    assert set(make_id(10, alphabet="abc")) <= set(['a', 'b', 'c'])
def test_make_id_length():
    for length in range_type(10):
        assert len(make_id(length)) == length
def test_make_id_type():
    assert isinstance(make_id(2), str)