deftest_key(self): d = Dict() d['key'] = 'value' self.assertEqual(d.key, 'value')
deftest_attr(self): d = Dict() d.key = 'value' self.assertTrue('key'in d) self.assertEqual(d['key'], 'value') deftest_keyerror(self): d = Dict() with self.assertRaises(KeyError): value = d['empty']
deftest_attrerror(self): d = Dict() with self.assertRaises(AttributeError): value = d.empty if __name__ == '__main__': unittest.main()