MCPcopy Index your code
hub / github.com/dask/dask / test_arithmetic

Function test_arithmetic

dask/array/tests/test_array_core.py:2609–2753  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2607
2608@pytest.mark.filterwarnings("ignore:numpy.fix")
2609def test_arithmetic():
2610 x = np.arange(5).astype("f4") + 2
2611 y = np.arange(5).astype("i8") + 2
2612 z = np.arange(5).astype("i4") + 2
2613 a = da.from_array(x, chunks=(2,))
2614 b = da.from_array(y, chunks=(2,))
2615 c = da.from_array(z, chunks=(2,))
2616 assert_eq(a + b, x + y)
2617 assert_eq(a * b, x * y)
2618 assert_eq(a - b, x - y)
2619 assert_eq(a / b, x / y)
2620 assert_eq(b & b, y & y)
2621 assert_eq(b | b, y | y)
2622 assert_eq(b ^ b, y ^ y)
2623 assert_eq(a // b, x // y)
2624 assert_eq(a**b, x**y)
2625 assert_eq(a % b, x % y)
2626 assert_eq(a > b, x > y)
2627 assert_eq(a < b, x < y)
2628 assert_eq(a >= b, x >= y)
2629 assert_eq(a <= b, x <= y)
2630 assert_eq(a == b, x == y)
2631 assert_eq(a != b, x != y)
2632
2633 assert_eq(a + 2, x + 2)
2634 assert_eq(a * 2, x * 2)
2635 assert_eq(a - 2, x - 2)
2636 assert_eq(a / 2, x / 2)
2637 assert_eq(b & True, y & True)
2638 assert_eq(b | True, y | True)
2639 assert_eq(b ^ True, y ^ True)
2640 assert_eq(a // 2, x // 2)
2641 assert_eq(a**2, x**2)
2642 assert_eq(a % 2, x % 2)
2643 assert_eq(a > 2, x > 2)
2644 assert_eq(a < 2, x < 2)
2645 assert_eq(a >= 2, x >= 2)
2646 assert_eq(a <= 2, x <= 2)
2647 assert_eq(a == 2, x == 2)
2648 assert_eq(a != 2, x != 2)
2649
2650 assert_eq(2 + b, 2 + y)
2651 assert_eq(2 * b, 2 * y)
2652 assert_eq(2 - b, 2 - y)
2653 assert_eq(2 / b, 2 / y)
2654 assert_eq(True & b, True & y)
2655 assert_eq(True | b, True | y)
2656 assert_eq(True ^ b, True ^ y)
2657 assert_eq(2 // b, 2 // y)
2658 assert_eq(2**b, 2**y)
2659 assert_eq(2 % b, 2 % y)
2660 assert_eq(2 > b, 2 > y)
2661 assert_eq(2 < b, 2 < y)
2662 assert_eq(2 >= b, 2 >= y)
2663 assert_eq(2 <= b, 2 <= y)
2664 assert_eq(2 == b, 2 == y)
2665 assert_eq(2 != b, 2 != y)
2666

Callers

nothing calls this directly

Calls 7

assert_eqFunction · 0.90
astypeMethod · 0.45
arangeMethod · 0.45
realMethod · 0.45
imagMethod · 0.45
conjMethod · 0.45
clipMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…