We test how accurately the smoothed particle hydrodynamics (SPH) numerical technique can follow spherically symmetric Bondi accretion. Using the 3D SPH code gadget-3, we perform simulations of gas accretion on to a central supermassive black hole of mass 108 M⊙ within the radial range of 0.1–200 pc. We carry out simulations without and with radiative heating by a central X-ray corona and radiative cooling. For an adiabatic case, the radial profiles of hydrodynamical properties match the Bondi solution, except near the inner and outer radius of the computational domain. The deviation from the Bondi solution close to the inner radius is caused by the combination of numerical resolution, artificial viscosity and our inner boundary condition. Near the outer radius (≤200 pc), we observe either an outflow or development of a non-spherical inflow unless the outer boundary conditions are very stringently implemented. Despite these issues related to the boundary conditions, we find that adiabatic Bondi accretion can be reproduced for durations of a few dynamical times at the Bondi radius, and for longer times if the outer radius is increased. In particular, the mass inflow rate at the inner boundary, which we measure, is within 3–4 per cent of the Bondi accretion rate. With radiative heating and cooling included, the spherically accreting gas takes a longer time to reach a steady state than the adiabatic Bondi accretion runs, and in some cases does not reach a steady state even within several hundred dynamical times. We find that artificial viscosity causes excessive heating near the inner radius, making the thermal properties of the gas inconsistent with a physical solution. This overheating occurs typically only in the supersonic part of the flow, so that it does not affect the mass accretion rate. We see that increasing the X-ray luminosity produces a lower central mass inflow rate, implying that feedback due to radiative heating is operational in our simulations. With a sufficiently high X-ray luminosity, the inflowing gas is radiatively heated up, and an outflow develops. We conclude that the SPH simulations can capture the gas dynamics needed to study radiative feedback, provided artificial viscosity alters only highly supersonic part of the inflow.