'Validates that the appropriate rule violations were triggered.
Arguments:
data: A dict containing the \'rule\' (or rules) to be tests.
results: The results, containing violations to be validated.'

def _validate_data_rules(self, data, results):

    rules = []
    if isinstance(data['rule'], list):
        rules = data['rule']
    elif (data['rule'] is not None):
        rules.append(data['rule'])
    results.violations.sort(key=(lambda violation: violation.sort_key()))
    if (len(results.violations) != len(rules)):
        for violation in results.violations:
            print 'Found    violation:    {}'.format(violation.rule)
    self.assertEqual(len(results.violations), len(rules))
    for (violation, rule) in zip(results.violations, rules):
        self.assertEqual(violation.rule, rule)
