code: def test_max_step():
      rtol = 1e-3
      atol = 1e-6
      y0 = [1 / 3, 2 / 9]
      for method in [RK23, RK45, DOP853, Radau, BDF, LSODA]:
          for t_span in ([5, 9], [5, 1]):
              res = solve_ivp(
                  fun_rational,
                  t_span,
                  y0,
                  rtol=rtol,
                  max_step=0.5,
                  atol=atol,
                  method=method,
                  dense_output=True,
              )
              assert_equal(res.t[0], t_span[0])
              assert_equal(res.t[-1], t_span[-1])
              assert_(np.all(np.abs(np.diff(res.t)) <= 0.5 + 1e-15))
              assert_(res.t_events is None)
              assert_(res.success)
              assert_equal(res.status, 0)
  
              y_true = sol_rational(res.t)
              e = compute_error(res.y, y_true, rtol, atol)
              assert_(np.all(e < 5))
  
              tc = np.linspace(*t_span)
              yc_true = sol_rational(tc)
              yc = res.sol(tc)
  
              e = compute_error(yc, yc_true, rtol, atol)
              assert_(np.all(e < 5))
  
              assert_allclose(
                  res.sol(res.t), res.y, rtol=1e-15, atol=1e-15
              )
  
              assert_raises(
                  ValueError,
                  method,
                  fun_rational,
                  t_span[0],
                  y0,
                  t_span[1],
                  max_step=-1,
              )
  
              if method is not LSODA:
                  solver = method(
                      fun_rational,
                      t_span[0],
                      y0,
                      t_span[1],
                      rtol=rtol,
                      atol=atol,
                      max_step=1e-20,
                  )
                  message = solver.step()
  
                  assert_equal(solver.status, "failed")
                  assert_("step size is less" in message)
                  assert_raises(RuntimeError, solver.step)
  
imports: from itertools import product
  from numpy.testing import assert_, assert_allclose, assert_array_less, assert_equal, assert_no_warnings, suppress_warnings
  import pytest
  from pytest import raises
  import numpy
  from scipy.optimize._numdiff import group_columns
  from scipy.integrate import solve_ivp, RK23, RK45, DOP853, Radau, BDF, LSODA
  from scipy.integrate import OdeSolution
  from scipy.integrate._ivp.common import num_jac
  from scipy.integrate._ivp.base import ConstantDenseOutput
  from scipy.sparse import coo_matrix, csc_matrix
label_desc: Use image node_id 26 for calling a global function with example usage: test_max_step() without return types