MCPcopy Create free account
hub / github.com/PaddlePaddle/Paddle / test_insert

Method test_insert

test/sot/test_mutable_data.py:267–279  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

265 var.getitem(1)
266
267 def test_insert(self):
268 data = [1, 2, 3]
269 var = ListVariable(data)
270 var.insert(0, ConstVariable(4))
271 self.assertEqual(
272 [var.getitem(i) for i in range(var.proxy.length)],
273 [ConstVariable(n) for n in [4, 1, 2, 3]],
274 )
275 var.insert(2, ConstVariable(5))
276 self.assertEqual(
277 [var.getitem(i) for i in range(var.proxy.length)],
278 [ConstVariable(n) for n in [4, 1, 5, 2, 3]],
279 )
280
281 def test_append(self):
282 data = [1, 2, 3]

Callers

nothing calls this directly

Calls 5

insertMethod · 0.95
getitemMethod · 0.95
ConstVariableClass · 0.85
rangeFunction · 0.85
ListVariableClass · 0.70

Tested by

no test coverage detected