def test_flatten_containing_NaN(): a = [[0], [1, 2], np.array([np.nan, 1]), [np.array([10]), np.array([1, 2])]] flat = flatten(a) assert np.allclose(flat, [0.0, 1.0, 2.0, np.NaN, 1.0, 10.0, 1.0, 2.0], equal_nan=True)
def test_flatten(): a = [[0], [1, 2], np.array([10, 1]), [np.array([10])]] flat = flatten(a) assert flat == [0.0, 1.0, 2.0, 10.0, 1.0, 10.0]
def test_flatten_different_shape(): a = [[0], [1, 2], np.array([10, 1]), [np.array([10]), np.array([1, 2])]] flat = flatten(a) assert flat == [0.0, 1.0, 2.0, 10.0, 1.0, 10.0, 1.0, 2.0]