Repository: PlasmaPy/PlasmaPy

Issue:
Fix xfailing tests in `test_nullpoint.py` for NumPy 1.24+
We started getting the following failures when we started using NumPy 1.24 (though there's a small chance that it's from a different package).  I'm not sure what caused the change, but for the time I'm marking these tests as xfailing in #2098. We'd probably need to go through these with a debugger step by step.

```
______________________________________ test_null_point_find4 _______________________________________
tests/test_nullpoint.py:302: in test_null_point_find4
    npoints4 = uniform_null_point_find(**nullpoint4_args)
nullpoint.py:1526: in uniform_null_point_find
    vspace = _vector_space(
nullpoint.py:254: in _vector_space
    return np.array([x, y, z]), np.array([u, v, w]), np.array([dx, dy, dz])
E   ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (3,) + inhomogeneous part.
______________________________________ test_null_point_find8 _______________________________________
tests/test_nullpoint.py:381: in test_null_point_find8
    npoints8 = uniform_null_point_find(**nullpoint8_args)
nullpoint.py:1526: in uniform_null_point_find
    vspace = _vector_space(
nullpoint.py:254: in _vector_space
    return np.array([x, y, z]), np.array([u, v, w]), np.array([dx, dy, dz])
E   ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (3,) + inhomogeneous part.
___________ Test_classify_null_point.test_classify_null_point_vals[kwargs2-Spiral null] ____________
tests/test_nullpoint.py:457: in test_classify_null_point_vals
    assert uniform_null_point_find(**kwargs)[0].classification == expected
nullpoint.py:1526: in uniform_null_point_find
    vspace = _vector_space(
nullpoint.py:254: in _vector_space
    return np.array([x, y, z]), np.array([u, v, w]), np.array([dx, dy, dz])
E   ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (3,) + inhomogeneous part.
===================================== short test summary info ======================================
FAILED tests/test_nullpoint.py::test_null_point_find4 - ValueError: setting an array element with a sequence. The requested array has an inhomogeneous ...
FAILED tests/test_nullpoint.py::test_null_point_find8 - ValueError: setting an array element with a sequence. The requested array has an inhomogeneous ...
FAILED tests/test_nullpoint.py::Test_classify_null_point::test_classify_null_point_vals[kwargs2-Spiral null] - ValueError: setting an array element with a sequence. The requested array has an inhomogeneous ...
```


Discussion:

Resolving patch:
diff --git a/plasmapy/analysis/nullpoint.py b/plasmapy/analysis/nullpoint.py
--- a/plasmapy/analysis/nullpoint.py
+++ b/plasmapy/analysis/nullpoint.py
@@ -251,7 +251,7 @@ def _vector_space(
         w = w_arr
     else:
         u, v, w = func(x, y, z)
-    return np.array([x, y, z]), np.array([u, v, w]), np.array([dx, dy, dz])
+    return np.array([x, y, z]), np.array([u, v, w]), [dx, dy, dz]
 
 
 def _trilinear_coeff_cal(vspace, cell):


Test patch:
diff --git a/plasmapy/analysis/tests/test_nullpoint.py b/plasmapy/analysis/tests/test_nullpoint.py
--- a/plasmapy/analysis/tests/test_nullpoint.py
+++ b/plasmapy/analysis/tests/test_nullpoint.py
@@ -289,7 +289,6 @@ def test_null_point_find3():
 
 
 @pytest.mark.slow()
-@pytest.mark.xfail(np.__version__ >= "1.24.0", reason="See issue #2101.")
 def test_null_point_find4():
     r"""Test `~plasmapy.analysis.nullpoint.null_point_find`."""
     # Two null points
@@ -369,7 +368,6 @@ def test_null_point_find7():
 
 
 @pytest.mark.slow()
-@pytest.mark.xfail(np.__version__ >= "1.24.0", reason="See issue #2101.")
 def test_null_point_find8():
     r"""Test `~plasmapy.analysis.nullpoint.null_point_find`."""
     # Non-linear field
@@ -426,9 +424,6 @@ class Test_classify_null_point:
                 "func": lambda x, y, z: [(y - 5.5) * (y + 5.5), (z - 5.5), (x - 5.5)],
             },
             "Spiral null",
-            marks=pytest.mark.xfail(
-                np.__version__ >= "1.24.0", reason="See issue #2101."
-            ),
         ),
         (
             {