Beispiel #1
0
 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'])
Beispiel #2
0
 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'])
Beispiel #3
0
 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)
Beispiel #4
0
 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)
Beispiel #5
0
 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)
Beispiel #6
0
 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)