<commit_before>require 'helper'
require 'peddler/xml_response_parser'

class TestPeddlerXMLResponseParser < MiniTest::Test
  def test_parses_responses
    body = '<Response><Result><Foo>Bar</Foo></Result></Response>'
    parser = Peddler::XMLResponseParser.new(response(body))
    assert_equal 'Bar', parser.parse['Foo']
  end

  def test_parses_messages
    body = '<Response><MessageType>ProcessingReport</MessageType><Message><Foo>Bar</Foo></Message></Response>'
    parser = Peddler::XMLResponseParser.new(response(body))
    assert_equal 'Bar', parser.parse['Foo']
  end

  def test_parses_reports
    body = '<fooReports><fooReport><foo>Bar</foo></fooReport></fooReports>'
    parser = Peddler::XMLResponseParser.new(response(body))
    assert_equal 'Bar', parser.parse['foo']
  end

  def test_parses_next_token
    body = '<Response><Result><NextToken>123</NextToken></Result></Response>'
    parser = Peddler::XMLResponseParser.new(response(body))
    assert_equal '123', parser.next_token
  end

  private

  def response(body)
    OpenStruct.new(
      body: body,
      headers: { 'Content-Type' => 'text/xml', 'Content-Length' => '78' }
    )
  end
end<commit_msg>Fix superficial error in test<commit_after>require 'helper'
require 'peddler/xml_response_parser'

class TestPeddlerXMLResponseParser < MiniTest::Test
  def test_parses_responses
    body = '<Response><Result><Foo>Bar</Foo></Result></Response>'
    parser = Peddler::XMLResponseParser.new(response(body))
    assert_equal 'Bar', parser.parse['Foo']
  end

  def test_parses_messages
    body = '<Response><MessageType>ProcessingReport</MessageType><Message><Foo>Bar</Foo></Message></Response>'
    parser = Peddler::XMLResponseParser.new(response(body))
    assert_equal 'Bar', parser.parse['Foo']
  end

  def test_parses_reports
    body = '<fooReports><fooReport><foo>Bar</foo></fooReport></fooReports>'
    parser = Peddler::XMLResponseParser.new(response(body))
    assert_equal 'Bar', parser.parse['foo']
  end

  def test_parses_next_token
    body = '<Response><Result><NextToken>123</NextToken></Result></Response>'
    parser = Peddler::XMLResponseParser.new(response(body))
    assert_equal '123', parser.next_token
  end

  private

  def response(body)
    OpenStruct.new(
      body: body,
      headers: { 'Content-Type' => 'text/xml', 'Content-Length' => body.size }
    )
  end
end
{'fraction_non_alphanumeric': 0.14610526315789474, 'fraction_numerical': 0.005894736842105263, 'mean_word_length': 5.0, 'pattern_counts': {'":': 0, '<': 57, '<?xml version=': 0, '>': 59, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, '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': '4883387', 'n_tokens_mistral': 778, 'n_tokens_neox': 740, 'n_words': 123}