<commit_before>require "test_helper"

module Competitions
  # :stopdoc:
  class CompetitionTest < ActiveSupport::TestCase
    class TestCompetition < Competition
      def friendly_name
        "KOM"
      end
    end

    class TestCompetitionWithSourceEvents < Competition
      def source_events?
        true
      end
    end

    test "find for year" do
      assert_equal nil, Competition.find_for_year, "Should not find anything when no Competitions in DB"
      assert_equal nil, Competition.find_for_year(2005), "Should not find anything when no Competitions in DB"

      competition = Competition.create!
      assert_equal competition, Competition.find_for_year, "Should find current Competition"
      assert_equal nil, Competition.find_for_year(2005), "Should not find anything when no Competitions in DB for this year"

      competition_in_2005 = Competition.create!(date: Time.zone.local(2005))<commit_msg>Fix missing require in test<commit_after>require "test_helper"
require_relative "../../../../app/models/competitions/calculations/structs"

module Competitions
  # :stopdoc:
  class CompetitionTest < ActiveSupport::TestCase
    class TestCompetition < Competition
      def friendly_name
        "KOM"
      end
    end

    class TestCompetitionWithSourceEvents < Competition
      def source_events?
        true
      end
    end

    test "find for year" do
      assert_equal nil, Competition.find_for_year, "Should not find anything when no Competitions in DB"
      assert_equal nil, Competition.find_for_year(2005), "Should not find anything when no Competitions in DB"

      competition = Competition.create!
      assert_equal competition, Competition.find_for_year, "Should find current Competition"
      assert_equal nil, Competition.find_for_year(2005), "Should not find anything when no Competitions in DB for this year"

      competition_in_2005 = Competition.create!(date: Time.zone.local(2005))
{'fraction_non_alphanumeric': 0.06604747162022703, 'fraction_numerical': 0.016511867905056758, 'mean_word_length': 3.627684964200477, 'pattern_counts': {'":': 0, '<': 9, '<?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': '974159', 'n_tokens_mistral': 555, 'n_tokens_neox': 504, 'n_words': 165}