Changeset 8aea9a0 in flexoentity for tests/test_id_stress.py


Ignore:
Timestamp:
10/19/25 17:55:13 (3 months ago)
Author:
Enrico Schwass <ennoausberlin@…>
Branches:
master
Children:
dfce52b
Parents:
3a0b0ce
Message:

fix tests

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tests/test_id_stress.py

    r3a0b0ce r8aea9a0  
    2626    assert len(ids) == len(set(ids)), "ID collisions detected in bulk generation"
    2727
    28 
    29 def test_disambiguator_trigger():
    30     """
    31     Force a deterministic collision by hashing same text twice.
    32     Should produce -A suffix for second one.
    33     """
    34     domain = "AF"
    35     etype = EntityType.QUESTION
    36     estate = EntityState.DRAFT
    37     text = "identical question text"
    38     id1 = FlexOID.generate(domain, etype, estate, text)
    39     id2 = FlexOID.generate(domain, etype, estate, text)
    40     assert id1 != id2
    41     assert id1.signature == id2.signature
    42     assert "-A" in str(id2), f"Expected '-A' suffix in disambiguated ID, got {id2}"
    43 
    44 
     28    def test_disambiguator_trigger():
     29        """
     30        Generating the same entity twice with same inputs yields identical ID.
     31        (No runtime disambiguation; IDs are deterministic by design.)
     32        """
     33        domain = "AF"
     34        etype = EntityType.QUESTION
     35        estate = EntityState.DRAFT
     36        text = "identical question text"
     37        id1 = FlexOID.generate(domain, etype, estate, text)
     38        id2 = FlexOID.generate(domain, etype, estate, text)
     39        # IDs must be identical, because we now enforce determinism, not randomization
     40        assert id1 == id2
     41        assert id1.signature == id2.signature
     42   
    4543def test_id_reproducibility_across_runs():
    4644    """
Note: See TracChangeset for help on using the changeset viewer.