This is a big assumption -- what happens if `tests` doesn't have the structure you expect?  You should be careful about accessing the `id` attribute without first checking that it exists.