angzarr_client.testing.uuid¶
Deterministic UUID generation for tests.
Provides functions for generating consistent, reproducible UUIDs based on string names. This ensures tests produce the same IDs across runs.
Attributes¶
Functions¶
|
Generate a deterministic 16-byte UUID from a name. |
|
Generate a deterministic UUID string from a name. |
|
Generate a deterministic UUID object from a name. |
Module Contents¶
- angzarr_client.testing.uuid.DEFAULT_TEST_NAMESPACE¶
- angzarr_client.testing.uuid.uuid_for(name: str, namespace: uuid.UUID = DEFAULT_TEST_NAMESPACE) bytes¶
Generate a deterministic 16-byte UUID from a name.
The same name always generates the same UUID within a namespace. Returns bytes suitable for use as aggregate root IDs.
- Parameters:
name – A string identifier (e.g., “player-alice”, “table-1”)
namespace – UUID namespace for generation (defaults to test namespace)
- Returns:
16-byte UUID as bytes
Example
root = uuid_for(“player-alice”) assert len(root) == 16 assert uuid_for(“player-alice”) == root # deterministic
- angzarr_client.testing.uuid.uuid_str_for(name: str, namespace: uuid.UUID = DEFAULT_TEST_NAMESPACE) str¶
Generate a deterministic UUID string from a name.
- Parameters:
name – A string identifier
namespace – UUID namespace for generation
- Returns:
UUID as standard string format (8-4-4-4-12)
Example
id_str = uuid_str_for(“player-alice”) assert “-” in id_str # standard UUID format
- angzarr_client.testing.uuid.uuid_obj_for(name: str, namespace: uuid.UUID = DEFAULT_TEST_NAMESPACE) uuid.UUID¶
Generate a deterministic UUID object from a name.
- Parameters:
name – A string identifier
namespace – UUID namespace for generation
- Returns:
UUID object
Example
id_obj = uuid_obj_for(“player-alice”) assert id_obj.bytes == uuid_for(“player-alice”)