本文整理汇总了Python中Vector.Vector.append方法的典型用法代码示例。如果您正苦于以下问题:Python Vector.append方法的具体用法?Python Vector.append怎么用?Python Vector.append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vector.Vector
的用法示例。
在下文中一共展示了Vector.append方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testExtendByEmpty
# 需要导入模块: from Vector import Vector [as 别名]
# 或者: from Vector.Vector import append [as 别名]
def testExtendByEmpty(self):
vec = Vector()
for i in range(BIG_VEC_SIZE):
vec.append(i)
self.bigVec.extend(Vector())
self.assertEqual(self.bigVec, vec)
self.assertEqual(self.bigVec, self.cleanBigVec)
示例2: testInsertAtStartNegative
# 需要导入模块: from Vector import Vector [as 别名]
# 或者: from Vector.Vector import append [as 别名]
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)
示例3: testRemoveAtEnd
# 需要导入模块: from Vector import Vector [as 别名]
# 或者: from Vector.Vector import append [as 别名]
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)
示例4: testRemoveWithDuplicates
# 需要导入模块: from Vector import Vector [as 别名]
# 或者: from Vector.Vector import append [as 别名]
def testRemoveWithDuplicates(self):
vec = Vector()
vec.append("a")
vec.append("b")
vec.append("c")
self.duplicatesVec.remove("b")
self.assertEquals(vec, self.duplicatesVec)
示例5: testExtendByNonVector
# 需要导入模块: from Vector import Vector [as 别名]
# 或者: from Vector.Vector import append [as 别名]
def testExtendByNonVector(self):
vec1 = Vector()
vec2 = Vector()
vec1.extend(["a", "b"])
vec2.append("a")
vec2.append("b")
self.assertEqual(vec1, vec2)
示例6: testInsertAtEnd
# 需要导入模块: from Vector import Vector [as 别名]
# 或者: from Vector.Vector import append [as 别名]
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)
示例7: testExtendGood
# 需要导入模块: from Vector import Vector [as 别名]
# 或者: from Vector.Vector import append [as 别名]
def testExtendGood(self):
vec = Vector()
for i in range(BIG_VEC_SIZE):
vec.append(i)
vec.append(10)
self.bigVec.extend(self.oneVec)
self.assertEqual(self.bigVec, vec)
示例8: testEqualsOutOfOrder
# 需要导入模块: from Vector import Vector [as 别名]
# 或者: from Vector.Vector import append [as 别名]
def testEqualsOutOfOrder(self):
vec1 = Vector()
vec1.append("a")
vec1.append("b")
vec2 = Vector()
vec2.append("b")
vec2.append("a")
self.assertFalse(vec1 == vec2)
示例9: testManyRemoves
# 需要导入模块: from Vector import Vector [as 别名]
# 或者: from Vector.Vector import append [as 别名]
def testManyRemoves(self):
vec = Vector()
for i in range(50, BIG_VEC_SIZE):
vec.append(i)
for i in range(50):
self.bigVec.remove(i)
self.assertEquals(vec, self.bigVec)
示例10: testNotEqualsOutOfOrder
# 需要导入模块: from Vector import Vector [as 别名]
# 或者: from Vector.Vector import append [as 别名]
def testNotEqualsOutOfOrder(self):
vec1 = Vector()
vec1.append("a")
vec1.append("b")
vec2 = Vector()
vec2.append("b")
vec2.append("a")
self.assertNotEqual(vec1, vec2)
示例11: testRemoveAtStart
# 需要导入模块: from Vector import Vector [as 别名]
# 或者: from Vector.Vector import append [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)
示例12: testPop
# 需要导入模块: from Vector import Vector [as 别名]
# 或者: from Vector.Vector import append [as 别名]
def testPop(self):
testV = Vector()
for i in range(BIG_VEC_SIZE):
testV.append(i)
testV.pop(5)
self.bigVec.pop(5)
for i in range(10,20):
testV.pop(i)
self.bigVec.pop(i)
self.assertRaises(IndexError, testV.pop, -7)
self.assertRaises(IndexError, testV.pop, BIG_VEC_SIZE + 5)
self.assertEqual(testV, self.bigVec)
示例13: testInsertMiddle
# 需要导入模块: from Vector import Vector [as 别名]
# 或者: from Vector.Vector import append [as 别名]
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)
示例14: testSliceSizeOneStartNegative
# 需要导入模块: from Vector import Vector [as 别名]
# 或者: from Vector.Vector import append [as 别名]
def testSliceSizeOneStartNegative(self):
vec = Vector()
vec.append(0)
self.assertEquals(self.bigVec.getSlice(-BIG_VEC_SIZE,-BIG_VEC_SIZE+1),
vec)
self.assertEqual(self.bigVec, self.cleanBigVec)
示例15: testSliceSizeOneEnd
# 需要导入模块: from Vector import Vector [as 别名]
# 或者: from Vector.Vector import append [as 别名]
def testSliceSizeOneEnd(self):
vec = Vector()
vec.append(BIG_VEC_SIZE -1)
self.assertEquals(self.bigVec.getSlice(BIG_VEC_SIZE-1, BIG_VEC_SIZE),
vec)
self.assertEqual(self.bigVec, self.cleanBigVec)