Changeset 6ad031b in flexoentity for tests/test_id_stress.py
- Timestamp:
- 11/18/25 13:34:13 (2 months ago)
- Branches:
- master
- Children:
- 8840db7
- Parents:
- 4dc09bb
- File:
-
- 1 edited
-
tests/test_id_stress.py (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tests/test_id_stress.py
r4dc09bb r6ad031b 14 14 logger = logging.getLogger(__name__) 15 15 16 def test_bulk_generation_uniqueness( domain):16 def test_bulk_generation_uniqueness(sample_domain): 17 17 """ 18 18 Generate 100,000 IDs and ensure uniqueness using safe_generate(). … … 33 33 ids = [] 34 34 for seed in seeds: 35 oid = FlexOID.safe_generate(domain.domain_code, entity_type.value, estate.value, seed, repo=repo) 35 oid = FlexOID.safe_generate(sample_domain.domain_id, entity_type.value, 36 estate.value, seed, repo=repo) 36 37 assert isinstance(oid, FlexOID) 37 38 ids.append(str(oid)) … … 48 49 49 50 # Sanity check: IDs should look canonical 50 assert all(id_str.startswith("GEN") for id_str in ids)51 # assert all(id_str.startswith("GENERIC") for id_str in ids) 51 52 assert all("@" in id_str for id_str in ids) 52 53 53 def test_id_generation_is_deterministic( domain):54 def test_id_generation_is_deterministic(sample_domain): 54 55 """ 55 56 Generating the same entity twice with same inputs yields identical ID. … … 60 61 text = "identical question text" 61 62 62 id1 = FlexOID.generate( domain.domain_code, entity_type.value, estate.value, text)63 id2 = FlexOID.generate( domain.domain_code, entity_type.value, estate.value, text)63 id1 = FlexOID.generate(sample_domain.domain_id, entity_type.value, estate.value, text) 64 id2 = FlexOID.generate(sample_domain.domain_id, entity_type.value, estate.value, text) 64 65 # IDs must be identical because generation is deterministic 65 66 assert id1 == id2 66 67 68 # def test_id_reproducibility_across_runs(domain):69 # """70 # The same seed on a new process (fresh _seen_hashes)71 # should yield the same base ID (without suffix).72 # """73 # entity_type = EntityType.CATALOG74 # estate = EntityState.DRAFT75 # seed = "reproducibility test seed"76 77 # id1 = FlexOID.generate(domain.domain_code, entity_type.value, estate.value, seed)78 # FlexOID._seen_hashes.clear()79 # id2 = FlexOID.generate(domain.domain_code, entity_type.value, estate.value, seed)80 81 # assert id1 == id282 67 83 68
Note:
See TracChangeset
for help on using the changeset viewer.
