def test___getitem__(self):
        mapping = self._settings_mapping
        self.assertEqual(mapping['enabled'], True)
        self.assertEqual(mapping['folderol'], 'bar')
        self.assertEqual(mapping['my_setting'], 'eek')
        self.assertEqual(mapping['your_setting'], "Howdy")

        self.assertEqual(mapping.enabled, True)
        self.assertEqual(mapping.folderol, 'bar')
        self.assertEqual(mapping.my_setting, 'eek')
        self.assertEqual(mapping.your_setting, "Howdy")

        def get_bad_item(bad_key):
            return mapping[bad_key]

        def get_bad_attr(bad_attr):
            return getattr(mapping, bad_attr)

        def get_hidden_item():
            return mapping['history']

        def get_hidden_attr():
            return mapping.history

        self.assertRaises(KeyError, get_bad_item, 'no_such_key')
        self.assertRaises(AttributeError, get_bad_attr, 'no_such_attr')

        self.assertRaises(KeyError, get_hidden_item)
        self.assertRaises(AttributeError, get_hidden_attr)
Test descriptors too
dataset/ETHPy150Open Twangist/log_calls/log_calls/tests/test_deco_settings.py/TestDecoSettingsMapping.test___getitem__