I think this commit mixes up parsing of non-finite numbers, which we may or may not want, with general test improvements, which we'll want regardless. Please split the patch.
On the parsing of non-finite numbers: the code looks good to me, but as long as we're not ready to extend QMP to include non-finite numbers both ways, I doubt we need to parse them.