<commit_before>module KnowsAboutSearchServiceResponseValidation
  def validate_book_search_results(data, count: 50, min_count: 1, offset: 0)
    validate_attribute(data, "type", type: String)
    validate_attribute(data, "numberOfResults", type: Numeric)
    validate_attribute(data, "id", type: String) unless data["type"].include?("similar") #the response for search/books/isbn/similar does not return an id
    actual_count = 0
    data['books'].each do |book|
      actual_count += 1
      validate_book_result(book)
    end if data["books"]
    expect(actual_count).to eq(count) if count != 50
    expect(actual_count).to be >= min_count
    validate_offset(data, offset) if offset != 0
  end<commit_msg>Skip min_count assertion when search is expected to return no books<commit_after>module KnowsAboutSearchServiceResponseValidation
  def validate_book_search_results(data, count: 50, min_count: 1, offset: 0)
    validate_attribute(data, "type", type: String)
    validate_attribute(data, "numberOfResults", type: Numeric)
    validate_attribute(data, "id", type: String) unless data["type"].include?("similar") #the response for search/books/isbn/similar does not return an id
    actual_count = 0
    data['books'].each do |book|
      actual_count += 1
      validate_book_result(book)
    end if data["books"]
    expect(actual_count).to eq(count) if count != 50
    expect(actual_count).to be >= min_count unless count == 0
    validate_offset(data, offset) if offset != 0
  end
{'fraction_non_alphanumeric': 0.10738255033557047, 'fraction_numerical': 0.012751677852348993, 'mean_word_length': 4.801556420233463, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '5895954', 'n_tokens_mistral': 459, 'n_tokens_neox': 434, 'n_words': 128}