from foundry.utils import frozendict from nose.tools import raises class TestFrozenDict(object): def setup(self): self.inputs = { 'foo': 'bar' } self.dict_ = frozendict(self.inputs) @raises(AttributeError) def test_should_not_allow_assignment(self): self.dict_['bar'] = 'baz' def test_should_use_precomputed_hash(self): assert hash(self.dict_) == self.dict_._frozendict__hash def test_should_set_slots(self): assert self.dict_.__slots__ == self.inputs.keys()