code: def test_ndarray_sum():
      np_m = np.array([[1, 2], [3, 4]])
      m = hl.nd.array(np_m)
  
      assert_ndarrays_eq(
          (m.sum(axis=0), np_m.sum(axis=0)),
          (m.sum(axis=1), np_m.sum(axis=1)),
          (m.sum(tuple([])), np_m.sum(tuple([]))),
      )
  
      assert hl.eval(m.sum()) == 10
      assert hl.eval(m.sum((0, 1))) == 10
  
      bool_nd = hl.nd.array([[True, False, True], [False, True, True]])
      assert hl.eval(bool_nd.sum()) == 4
  
      with pytest.raises(ValueError) as exc:
          m.sum(3)
      assert "out of bounds for ndarray of dimension 2" in str(
          exc.value
      )
  
      with pytest.raises(ValueError) as exc:
          m.sum((1, 1))
      assert "duplicate" in str(exc.value)
  
imports: import math
  import numpy
  import re
  from ..helpers import *
  import pytest
  from hail.utils.java import FatalError, HailUserError
label_desc: Use image node_id 13 for calling a global function with example usage: test_ndarray_sum() without return types