Followup to D127898. This patch makes the optional model tests much nicer by removing the second parameter (list of expected diagnostics) entirely, and instead just checking the set of annotation line numbers against the set of diagnostics (so you only write annotations on exactly the set of lines where you expect a diagnostic).
Currently this just reuses the existing buildStatementToAnnotationMapping which already gets called in checkDataflowHelper, so all annotations are required to be ranges and attached to specific statements. @gribozavr2 originally suggested just letting the annotations exist à la carte and using their line numbers directly, which I think would be a better idea since it would allow us to deal with statements spanning multiple lines. That would take more implementation effort though, so I'm leaving it to a followup.