<commit_before>require_relative '../test_helper'

describe YoutubeDL::Output do
  describe '#initialize' do
    it 'should set the output variable' do
      sample_output = "some sample output\n\n"
      parser = YoutubeDL::Output.new(sample_output)
      assert_equal sample_output, parser.output
    end
  end

  describe '#supported_formats' do
    before do
      @parser = YoutubeDL::Output.new(fixture(:output, :list_formats))
    end

    it 'should find a match given the correct output' do
      refute_nil @parser.supported_formats
    end

    it 'should find the correct match and in the correct format' do
      assert_includes(@parser.supported_formats, {format_code: 5, extension: 'flv', resolution: '400x240', note: 'small'})
    end

    it 'should return nil if no match or wrong log format' do
      bad_parser = YoutubeDL::Output.new(fixture(:output, :download))
      assert_nil bad_parser.supported_formats
    end
  end

  describe '#filename' do
    before do
      @parser_download = YoutubeDL::Output.new(fixture(:output, :download))
      @parser_download_ffmpeg = YoutubeDL::Output.new(fixture(:output, :download_ffmpeg))
      @parser_download_exists = YoutubeDL::Output.new(fixture(:output, :download_exists))
    end

    it 'should find a match given the correct output' do
      refute_nil @parser_download.filename
      refute_nil @parser_download_ffmpeg.filename
      refute_nil @parser_download_exists.filename
    end

    it 'should find the correct match' do
      assert_equal 'nope.avi-gvdf5n-zI14.mp4', @parser_download.filename
      assert_equal 'nope.avi-gvdf5n-zI14.mp4', @parser_download_ffmpeg.filename
      assert_equal 'nope.avi-gvdf5n-zI14.mp4', @parser_download_exists.filename
    end

    it 'should return nil if no match or wrong log format' do
      bad_parser = YoutubeDL::Output.new(fixture(:output, :list_formats))
      assert_nil bad_parser.filename
    end
  end
<commit_msg>Added Output test<commit_after>require_relative '../test_helper'

describe YoutubeDL::Output do
  describe '#initialize' do
    it 'should set the output variable' do
      sample_output = "some sample output\n\n"
      parser = YoutubeDL::Output.new(sample_output)
      assert_equal sample_output, parser.output
    end
  end

  describe '#supported_formats' do
    before do
      @parser = YoutubeDL::Output.new(fixture(:output, :list_formats))
    end

    it 'should find a match given the correct output' do
      refute_nil @parser.supported_formats
    end

    it 'should find the correct match and in the correct format' do
      assert_includes(@parser.supported_formats, {format_code: 5, extension: 'flv', resolution: '400x240', note: 'small'})
    end

    it 'should return nil if no match or wrong log format' do
      bad_parser = YoutubeDL::Output.new(fixture(:output, :download))
      assert_nil bad_parser.supported_formats
    end
  end

  describe '#filename' do
    before do
      @parser_download = YoutubeDL::Output.new(fixture(:output, :download))
      @parser_download_ffmpeg = YoutubeDL::Output.new(fixture(:output, :download_ffmpeg))
      @parser_download_exists = YoutubeDL::Output.new(fixture(:output, :download_exists))
      @parser_download_audio = YoutubeDL::Output.new(fixture(:output, :download_audio))
    end

    it 'should find a match given the correct output' do
      refute_nil @parser_download.filename
      refute_nil @parser_download_ffmpeg.filename
      refute_nil @parser_download_exists.filename
      refute_nil @parser_download_audio.filename
    end

    it 'should find the correct match' do
      assert_equal 'nope.avi-gvdf5n-zI14.mp4', @parser_download.filename
      assert_equal 'nope.avi-gvdf5n-zI14.mp4', @parser_download_ffmpeg.filename
      assert_equal 'nope.avi-gvdf5n-zI14.mp4', @parser_download_exists.filename
      assert_equal 'nope-gvdf5n-zI14.mp3', @parser_download_audio.filename
    end

    it 'should return nil if no match or wrong log format' do
      bad_parser = YoutubeDL::Output.new(fixture(:output, :list_formats))
      assert_nil bad_parser.filename
    end
  end

{'fraction_non_alphanumeric': 0.08979990239141045, 'fraction_numerical': 0.010248901903367497, 'mean_word_length': 3.8223529411764705, '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': 31, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5192527', 'n_tokens_mistral': 1326, 'n_tokens_neox': 1256, 'n_words': 324}