def test_items(self): d = OrderedDictWithDefaults() self.assertEqual([], d.items()) d['key'] = 'Birds' d['len'] = '89' for _, v in d.items(): self.assertTrue(v in ['Birds', '89'])
def test_items(self): d = OrderedDictWithDefaults() self.assertEqual([], list(d.items())) d['key'] = 'Birds' d['len'] = '89' for _, v in list(d.items()): self.assertTrue(v in ['Birds', '89'])
def test_iteritems(self): d = OrderedDictWithDefaults() self.assertEqual([], list(d.items())) d['key'] = 'Birds' d['len'] = '89' d.defaults_ = {'surname': 'Wyndham'} count = 0 for k, v in d.items(): self.assertTrue(k in ['key', 'len', 'surname']) self.assertTrue(v in ['Birds', '89', 'Wyndham']) count += 1 self.assertEqual(3, count)
def test_iteritems(self): d = OrderedDictWithDefaults() self.assertEqual([], list(d.items())) d['key'] = 'Birds' d['len'] = '89' d.defaults_ = { 'surname': 'Wyndham' } count = 0 for k, v in d.items(): self.assertTrue(k in ['key', 'len', 'surname']) self.assertTrue(v in ['Birds', '89', 'Wyndham']) count += 1 self.assertEqual(3, count)
def test_contains(self): d = OrderedDictWithDefaults() self.assertEqual([], list(d.items())) d['key'] = 'Birds' d.defaults_ = {'value': '10'} self.assertTrue('key' in d) self.assertTrue('value' in d) self.assertFalse('test' in d)
def test_contains(self): d = OrderedDictWithDefaults() self.assertEqual([], list(d.items())) d['key'] = 'Birds' d.defaults_ = { 'value': '10' } self.assertTrue('key' in d) self.assertTrue('value' in d) self.assertFalse('test' in d)