Exemple #1
0
 def test_duplicate_keys(self):
     items = [('key1', 1), ('key1', 2), ('key3', 3), ('key1', 1)]
     keys = [x[0] for x in items]
     values = [x[1] for x in items]
     _dict = VDFDict(items)
     self.assertEqual(list(_dict.items()), items)
     self.assertEqual(list(_dict.keys()), keys)
     self.assertEqual(list(_dict.values()), values)
Exemple #2
0
 def test_duplicate_keys(self):
     items = [('key1', 1), ('key1', 2), ('key3', 3), ('key1', 1)]
     keys = [x[0] for x in items]
     values = [x[1] for x in items]
     _dict = VDFDict(items)
     self.assertEqual(list(_dict.items()), items)
     self.assertEqual(list(_dict.keys()), keys)
     self.assertEqual(list(_dict.values()), values)
Exemple #3
0
 def test_clear(self):
     a = VDFDict([("1", 2), ("1", 2), ("5", 3), ("1", 2)])
     a.clear()
     self.assertEqual(len(a), 0)
     self.assertEqual(len(a.keys()), 0)
     self.assertEqual(len(list(a.iterkeys())), 0)
     self.assertEqual(len(a.values()), 0)
     self.assertEqual(len(list(a.itervalues())), 0)
     self.assertEqual(len(a.items()), 0)
     self.assertEqual(len(list(a.iteritems())), 0)
Exemple #4
0
 def test_clear(self):
     a = VDFDict([("1",2),("1",2),("5",3),("1",2)])
     a.clear()
     self.assertEqual(len(a), 0)
     self.assertEqual(len(a.keys()), 0)
     self.assertEqual(len(list(a.iterkeys())), 0)
     self.assertEqual(len(a.values()), 0)
     self.assertEqual(len(list(a.itervalues())), 0)
     self.assertEqual(len(a.items()), 0)
     self.assertEqual(len(list(a.iteritems())), 0)
Exemple #5
0
 def test_values(self):
     _dict = VDFDict(self.map_test)
     self.assertSequenceEqual(list(_dict.values()),
                              list(x[1] for x in self.map_test))
Exemple #6
0
 def test_values(self):
     _dict = VDFDict(self.map_test)
     self.assertSequenceEqual(
         list(_dict.values()),
         list(x[1] for x in self.map_test))