示例#1
0
 def test_listproxy(self):
     v = []
     x = Proxy(lambda: v)
     x.append(1)
     x.extend([2, 3, 4])
     self.assertEqual(x[0], 1)
     self.assertEqual(x[:-1], [1, 2, 3])
     del(x[-1])
     self.assertEqual(x[:-1], [1, 2])
     x[0] = 10
     self.assertEqual(x[0], 10)
     self.assertIn(10, x)
     self.assertEqual(len(x), 3)
     self.assertTrue(iter(x))
示例#2
0
 def test_listproxy(self):
     v = []
     x = Proxy(lambda: v)
     x.append(1)
     x.extend([2, 3, 4])
     assert x[0] == 1
     assert x[:-1] == [1, 2, 3]
     del (x[-1])
     assert x[:-1] == [1, 2]
     x[0] = 10
     assert x[0] == 10
     assert 10 in x
     assert len(x) == 3
     assert iter(x)
     x[0:2] = [1, 2]
     del (x[0:2])
     assert str(x)
示例#3
0
 def test_listproxy(self):
     v = []
     x = Proxy(lambda: v)
     x.append(1)
     x.extend([2, 3, 4])
     assert x[0] == 1
     assert x[:-1] == [1, 2, 3]
     del (x[-1])
     assert x[:-1] == [1, 2]
     x[0] = 10
     assert x[0] == 10
     assert 10 in x
     assert len(x) == 3
     assert iter(x)
     x[0:2] = [1, 2]
     del (x[0:2])
     assert str(x)
     if sys.version_info[0] < 3:
         assert x.__cmp__(object()) == -1
示例#4
0
 def test_listproxy(self):
     v = []
     x = Proxy(lambda: v)
     x.append(1)
     x.extend([2, 3, 4])
     self.assertEqual(x[0], 1)
     self.assertEqual(x[:-1], [1, 2, 3])
     del(x[-1])
     self.assertEqual(x[:-1], [1, 2])
     x[0] = 10
     self.assertEqual(x[0], 10)
     self.assertIn(10, x)
     self.assertEqual(len(x), 3)
     self.assertTrue(iter(x))
     x[0:2] = [1, 2]
     del(x[0:2])
     self.assertTrue(str(x))
     if sys.version_info[0] < 3:
         self.assertEqual(x.__cmp__(object()), -1)
示例#5
0
 def test_listproxy(self):
     v = []
     x = Proxy(lambda: v)
     x.append(1)
     x.extend([2, 3, 4])
     self.assertEqual(x[0], 1)
     self.assertEqual(x[:-1], [1, 2, 3])
     del (x[-1])
     self.assertEqual(x[:-1], [1, 2])
     x[0] = 10
     self.assertEqual(x[0], 10)
     self.assertIn(10, x)
     self.assertEqual(len(x), 3)
     self.assertTrue(iter(x))
     x[0:2] = [1, 2]
     del (x[0:2])
     self.assertTrue(str(x))
     if sys.version_info[0] < 3:
         self.assertEqual(x.__cmp__(object()), -1)
示例#6
0
 def test_listproxy(self):
     v = []
     x = Proxy(lambda: v)
     x.append(1)
     x.extend([2, 3, 4])
     assert x[0] == 1
     assert x[:-1] == [1, 2, 3]
     del(x[-1])
     assert x[:-1] == [1, 2]
     x[0] = 10
     assert x[0] == 10
     assert 10 in x
     assert len(x) == 3
     assert iter(x)
     x[0:2] = [1, 2]
     del(x[0:2])
     assert str(x)
     if sys.version_info[0] < 3:
         assert x.__cmp__(object()) == -1