  The influence of mass inhomogeneities on the angular size-redshift test is
investigated for a large class of flat cosmological models driven by dark
energy plus a cold dark matter component. The results are presented in two
steps. First, the mass inhomogeneities are modeled by a generalized
Zeldovich-Kantowski-Dyer-Roeder (ZKDR) distance which is characterized by a
smoothness parameter $\alpha(z)$ and a power index $\gamma$, and, second, we
provide a statistical analysis to angular size data for a large sample of
milliarcsecond compact radio sources. By marginalizing over the characteristic
angular size $l$, fixing $\Omega_M = 0.26$ and assuming a Gaussian prior on
$\omega$, i.e., $\omega = -1 \pm 0.3$, the best fit values are $\omega = -1.03$
and $\alpha = 0.9$. By assuming a Gaussian prior on the matter density
parameter, i.e., $\Omega_M = 0.3 \pm 0.1$, the best fit model for a phantom
cosmology with $\omega = -1.2$ occurs at $\Omega_M = 0.29$ and $\alpha = 0.9$
when we marginalize over the characteristic size of the compact radio sources.
The results discussed here suggest that the ZKDR distance can give important
corrections to the so-called background tests of dark energy.
