'Asserts the number of references to the ID with
the given name.'

def assert_num_ID_refs(self, code, name, num):

    if isinstance(code, str):
        parsed = self.parse(code)
    else:
        parsed = code
    iv = self.IDNameCounter(name)
    iv.visit(parsed)
    self.assertEqual(iv.nrefs, num)
