MCPcopy Index your code
hub / github.com/quantopian/zipline / test_setitem_array

Method test_setitem_array

tests/test_labelarray.py:381–407  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

379 self.assertTrue((arr == val).all())
380
381 def test_setitem_array(self):
382 arr = LabelArray(self.strs, missing_value=None)
383 orig_arr = arr.copy()
384
385 # Write a row.
386 self.assertFalse(
387 (arr[0] == arr[1]).all(),
388 "This test doesn't test anything because rows 0"
389 " and 1 are already equal!"
390 )
391 arr[0] = arr[1]
392 for i in range(arr.shape[1]):
393 self.assertEqual(arr[0, i], arr[1, i])
394
395 # Write a column.
396 self.assertFalse(
397 (arr[:, 0] == arr[:, 1]).all(),
398 "This test doesn't test anything because columns 0"
399 " and 1 are already equal!"
400 )
401 arr[:, 0] = arr[:, 1]
402 for i in range(arr.shape[0]):
403 self.assertEqual(arr[i, 0], arr[i, 1])
404
405 # Write the whole array.
406 arr[:] = orig_arr
407 check_arrays(arr, orig_arr)
408
409 @staticmethod
410 def check_roundtrip(arr):

Callers

nothing calls this directly

Calls 4

LabelArrayClass · 0.90
check_arraysFunction · 0.90
rangeClass · 0.85
copyMethod · 0.80

Tested by

no test coverage detected