(self)
| 519 | ) |
| 520 | |
| 521 | def test_copy(self): |
| 522 | data = arange(5 * 3, dtype='f8').reshape(5, 3) |
| 523 | original_data = data.copy() |
| 524 | adjustments = {2: [Float64Multiply(0, 4, 0, 2, 2.0)]} |
| 525 | adjusted_array = AdjustedArray(data, adjustments, float('nan')) |
| 526 | traverse_copy = adjusted_array.copy() |
| 527 | clean_copy = adjusted_array.copy() |
| 528 | |
| 529 | a_it = adjusted_array.traverse(2, copy=False) |
| 530 | b_it = traverse_copy.traverse(2, copy=False) |
| 531 | for a, b in zip(a_it, b_it): |
| 532 | assert_equal(a, b) |
| 533 | |
| 534 | with self.assertRaises(ValueError) as e: |
| 535 | adjusted_array.copy() |
| 536 | |
| 537 | assert_equal( |
| 538 | str(e.exception), |
| 539 | 'cannot copy invalidated AdjustedArray', |
| 540 | ) |
| 541 | |
| 542 | # the clean copy should have the original data even though the |
| 543 | # original adjusted array has it's data mutated in place |
| 544 | assert_equal(clean_copy.data, original_data) |
| 545 | assert_equal(adjusted_array.data, original_data * 2) |
| 546 | |
| 547 | @parameterized.expand( |
| 548 | chain( |
nothing calls this directly
no test coverage detected