<commit_before>module Integration
  def spot_check(records, tests)
    headers = tests.shift
    tests.each do |test|
      where_clause = {}
      headers[0].each_with_index do |field, i|
        where_clause[field] = test[0][i]
      end
      record = records.where(where_clause).first
      headers[1].each_with_index do |field, i|
        record.send(field).should send("be_#{test[1][i]}")
      end
    end
  end
end<commit_msg>More detailed spot_check failures<commit_after>module Integration
  def spot_check(records, tests)
    headers = tests.shift
    tests.each do |test|
      where_clause = {}
      headers[0].each_with_index do |field, i|
        where_clause[field] = test[0][i]
      end
      record = records.where(where_clause).first
      record.should_not be_nil, "Expected to find a record with #{where_clause.inspect}"
      headers[1].each_with_index do |field, i|
        criterion = test[1][i]
        record.send(field).should send("be_#{criterion}"), "Expecting #{field} to be #{criterion} on #{record.inspect}"
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.11973807296538821, 'fraction_numerical': 0.007483629560336763, 'mean_word_length': 3.1153846153846154, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2616363', 'n_tokens_mistral': 351, 'n_tokens_neox': 349, 'n_words': 80}