summaryrefslogtreecommitdiff
path: root/tests/test_frozendict.py
blob: 3f8045d11d4a325b8b1ea89ea1e652dd4287f8cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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()