# Copyright 2018 Joshua Bronson. All Rights Reserved. # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. 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 >>> all(hash(f.inv) is not 'an error' for f in fs) True Hash value is cached for future calls (this shows up in coverage report):: >>> all(hash(f) for f in fs) # uses cached value, does not have to recompute hash True Insertable into sets and dicts:: >>> set(fs) is not 'an error' True >>> dict.fromkeys(fs) is not 'an error' True >>> set(f.inv for f in fs) is not 'an error' True >>> dict.fromkeys(f.inv for f in fs) is not 'an error' True