'Asserts the amount of klass nodes in the code.'

def assert_num_klass_nodes(self, code, klass, num):

    if isinstance(code, str):
        parsed = self.parse(code)
    else:
        parsed = code
    cv = self.NodeKlassCounter(klass)
    cv.visit(parsed)
    self.assertEqual(cv.n, num)
