コード例 #1
0
    def test_fad_init(self):
        fad = FixedAttrsDict(MagicMock(), properties={'a': 1, 'b': 2})

        # getting a non-existing attribute is handled correctly
        with self.assertRaises(AttributeError):
            fad.a = 2
        # non-existing attribute access is handled correctly
        with self.assertRaises(AttributeError):
            fad.foo
コード例 #2
0
    def test_fad_init(self):
        fad = FixedAttrsDict(MagicMock(), properties={'a': 1, 'b': 2})

        # getting a non-existing attribute is handled correctly
        with self.assertRaises(AttributeError):
            fad.a = 2
        # non-existing attribute access is handled correctly
        with self.assertRaises(AttributeError):
            fad.foo