MCPcopy Index your code
hub / github.com/numpy/numpy / assert_copy_equivalent

Function assert_copy_equivalent

numpy/_core/tests/test_mem_overlap.py:579–597  ·  view source on GitHub ↗

Check that operation(*args, out=out) produces results equivalent to out[...] = operation(*args, out=out.copy())

(operation, args, out, **kwargs)

Source from the content-addressed store, hash-verified

577
578
579def assert_copy_equivalent(operation, args, out, **kwargs):
580 """
581 Check that operation(*args, out=out) produces results
582 equivalent to out[...] = operation(*args, out=out.copy())
583 """
584
585 kwargs['out'] = out
586 kwargs2 = dict(kwargs)
587 kwargs2['out'] = out.copy()
588
589 out_orig = out.copy()
590 out[...] = operation(*args, **kwargs2)
591 expected = out.copy()
592 out[...] = out_orig
593
594 got = operation(*args, **kwargs).copy()
595
596 if (got != expected).any():
597 assert_equal(got, expected)
598
599
600class TestUFunc:

Callers 2

check_unary_fuzzMethod · 0.85

Calls 3

assert_equalFunction · 0.90
copyMethod · 0.45
anyMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…