本文整理汇总了Python中Vector.Vector.remove方法的典型用法代码示例。如果您正苦于以下问题:Python Vector.remove方法的具体用法?Python Vector.remove怎么用?Python Vector.remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vector.Vector
的用法示例。
在下文中一共展示了Vector.remove方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testRemoveAtStart
# 需要导入模块: from Vector import Vector [as 别名]
# 或者: from Vector.Vector import remove [as 别名]
def testRemoveAtStart(self):
vec = Vector()
for i in range(1,BIG_VEC_SIZE):
vec.append(i)
self.bigVec.remove(0)
vec.remove(0)
self.assertEqual(vec, self.bigVec)
示例2: VectorTester
# 需要导入模块: from Vector import Vector [as 别名]
# 或者: from Vector.Vector import remove [as 别名]
#.........这里部分代码省略.........
self.assertEqual(self.bigVec, vec)
def testInsertAtStartNegative(self):
self.bigVec.insert(-BIG_VEC_SIZE, "a")
vec = Vector()
vec.append("a")
for i in range(BIG_VEC_SIZE):
vec.append(i)
self.assertEqual(self.bigVec, vec)
def testInsertAtEnd(self):
self.bigVec.insert(BIG_VEC_SIZE, "a")
vec = Vector()
for i in range(BIG_VEC_SIZE):
vec.append(i)
vec.append("a")
self.assertEqual(self.bigVec, vec)
def testInsertMiddle(self):
vec1 = Vector()
vec1.append("a")
vec1.append("b")
vec1.append("c")
vec2 = Vector()
vec2.append("a")
vec2.append("c")
vec2.insert(1,"b")
self.assertEqual(vec1, vec2)
#--------------------------------------------------------
#TESTING METHODS FOR REMOVE
#--------------------------------------------------------
def testRemoveEmpty(self):
self.assertRaises(ValueError, self.emptyVec.remove, "a")
self.assertEqual(len(self.emptyVec), 0)
def testRemoveNotIn(self):
self.assertRaises(ValueError, self.bigVec.remove, "a")
self.assertEqual(self.bigVec, self.cleanBigVec)
def testRemoveLast(self):
self.oneVec.remove(10)
self.assertEqual(self.oneVec, Vector())
def testRemoveAtStart(self):
vec = Vector()
for i in range(1,BIG_VEC_SIZE):
vec.append(i)
self.bigVec.remove(0)
vec.remove(0)
self.assertEqual(vec, self.bigVec)
def testRemoveAtEnd(self):
vec = Vector()
for i in range(BIG_VEC_SIZE-1):
vec.append(i)
self.bigVec.remove(BIG_VEC_SIZE-1)
self.assertEqual(vec, self.bigVec)
def testManyRemoves(self):
vec = Vector()
for i in range(50, BIG_VEC_SIZE):
vec.append(i)