MCPcopy Create free account
hub / github.com/ashvardanian/StringZilla / test_fill_random_alphabet

Function test_fill_random_alphabet

scripts/test_stringzilla.py:990–1002  ·  view source on GitHub ↗
(length: int, seed_value: int)

Source from the content-addressed store, hash-verified

988@pytest.mark.parametrize("length", [0, 1, 7, 64])
989@pytest.mark.parametrize("seed_value", SEED_VALUES)
990def test_fill_random_alphabet(length: int, seed_value: int):
991
992 # Same nonce should produce the same result
993 random_string = sz.random(length, nonce=seed_value)
994 same_nonce_random_string = sz.random(length, nonce=seed_value)
995 assert isinstance(random_string, (bytes, bytearray))
996 assert len(random_string) == length
997 assert random_string == same_nonce_random_string
998
999 # With alphabet: all bytes must belong to alphabet
1000 alphabet = b"0123456789"
1001 random_digits = sz.random(128, nonce=seed_value, alphabet=alphabet)
1002 assert set(random_digits).issubset(set(alphabet))
1003
1004
1005@pytest.mark.parametrize("body", ["", "hello", "world", "abcdefg", "a" * 32])

Callers

nothing calls this directly

Calls 1

randomMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…