  We prove the test function conjecture of Kottwitz and the first named author
for local models of Shimura varieties with parahoric level structure attached
to Weil-restricted groups, as defined by B. Levin. Our result covers the
(modified) local models attached to all connected reductive groups over
$p$-adic local fields with $p\geq 5$. In addition, we give a self-contained
study of relative affine Grassmannians and loop groups formed using general
relative effective Cartier divisors in a relative curve over an arbitrary
Noetherian affine scheme.
