<commit_before># encoding: utf-8
$:.unshift(File.expand_path(File.dirname(__FILE__) + '/../')); $:.uniq!
begin
  require 'rubygems'
  require 'active_support'
rescue LoadError
  puts "not testing with Cache enabled because active_support can not be found"
end

require 'test_helper'
require 'api'

class I18nAllFeaturesApiTest < Test::Unit::TestCase
  class Backend
    include I18n::Backend::Base
    include I18n::Backend::Cache
    include I18n::Backend::Metadata
    include I18n::Backend::Cascade
    include I18n::Backend::Fallbacks
    include I18n::Backend::Pluralization
    include I18n::Backend::Memoize
  end

  def setup
    I18n.backend = I18n::Backend::Chain.new(Backend.new, I18n::Backend::Simple.new)
    I18n.cache_store = cache_store
    super
  end

  def teardown
    I18n.cache_store.clear
    I18n.cache_store = nil
    super
  end

  def cache_store
    ActiveSupport::Cache.lookup_store(:memory_store) if defined?(ActiveSupport) && defined?(ActiveSupport::Cache)
  end<commit_msg>Load I18n before loading AS.<commit_after># encoding: utf-8
$:.unshift(File.expand_path(File.dirname(__FILE__) + '/../')); $:.uniq!
require 'test_helper'
require 'api'

begin
  require 'rubygems'
  require 'active_support'
rescue LoadError
  puts "not testing with Cache enabled because active_support can not be found"
end

class I18nAllFeaturesApiTest < Test::Unit::TestCase
  class Backend
    include I18n::Backend::Base
    include I18n::Backend::Cache
    include I18n::Backend::Metadata
    include I18n::Backend::Cascade
    include I18n::Backend::Fallbacks
    include I18n::Backend::Pluralization
    include I18n::Backend::Memoize
  end

  def setup
    I18n.backend = I18n::Backend::Chain.new(Backend.new, I18n::Backend::Simple.new)
    I18n.cache_store = cache_store
    super
  end

  def teardown
    I18n.cache_store.clear
    I18n.cache_store = nil
    super
  end

  def cache_store
    ActiveSupport::Cache.lookup_store(:memory_store) if defined?(ActiveSupport) && defined?(ActiveSupport::Cache)
  end
{'fraction_non_alphanumeric': 0.1091358024691358, 'fraction_numerical': 0.02962962962962963, 'mean_word_length': 4.565934065934066, 'pattern_counts': {'":': 0, '<': 5, '<?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': '4600472', 'n_tokens_mistral': 692, 'n_tokens_neox': 680, 'n_words': 147}