mirror of https://github.com/jab/bidict.git
20 lines
595 B
Plaintext
20 lines
595 B
Plaintext
Test script for bidict.FrozenBidict::
|
|
|
|
>>> from bidict import FrozenBidict, FrozenOrderedBidict
|
|
>>> f1 = FrozenBidict(one=1)
|
|
>>> f2 = FrozenOrderedBidict([('one', 1), ('two', 2)])
|
|
>>> f3 = FrozenOrderedBidict([('two', 2), ('one', 1)])
|
|
>>> fs = (f1, f2, f3)
|
|
>>> all(hash(f) is not 'an error' for f in fs)
|
|
True
|
|
|
|
Cached hash value reused (for the sake of the coverage report)::
|
|
|
|
>>> all(hash(f) for f in fs) # should not have to call _compute_hash() again
|
|
True
|
|
|
|
Insertable into sets and dicts::
|
|
|
|
>>> dict.fromkeys(fs) and set(fs) is not 'an error'
|
|
True
|