<commit_before>require 'cases/helper'

class EagerLoadPolyAssocsTest < Test::Unit::TestCase
  NUM_SIMPLE_OBJS = 50
  NUM_SHAPE_EXPRESSIONS = 100

  def setup
    silence_stream(STDOUT) { create_test_tables }
    generate_test_object_graphs
  end

  def create_test_tables
    conn = ActiveRecord::Base.connection
    options = { :force => true, :options => "Engine=MyISAM" }

    [:circles, :squares, :triangles, :non_poly_ones, :non_poly_twos].each do |t|
      conn.create_table(t, options) { }
    end

    conn.create_table :shape_expressions, options do |t|
      t.string  :paint_type
      t.integer :paint_id
      t.string  :shape_type
      t.integer :shape_id
    end
    conn.create_table :paint_colors, options do |t|
      t.integer :non_poly_one_id
    end
    conn.create_table :paint_textures, options do |t|
      t.integer :non_poly_two_id
    end
  end

  def teardown
    drop_tables
  end

  def drop_tables
    conn = ActiveRecord::Base.connection
    conn.reconnect!

    silence_stream(STDOUT) do
      [:circles, :squares, :triangles, :paint_colors, :paint_textures,
       :shape_expressions, :non_poly_ones, :non_poly_twos].each do |t|
        conn.drop_table t
      end
    end
  end

  # meant to be supplied as an ID, never returns 0
  def rand_simple
    val = (NUM_SIMPLE_OBJS * rand).round
    val == 0 ? 1 : val
  end
<commit_msg>Remove mysql option from a test that applies to all databases. References #11154.<commit_after>require 'cases/helper'

class EagerLoadPolyAssocsTest < Test::Unit::TestCase
  NUM_SIMPLE_OBJS = 50
  NUM_SHAPE_EXPRESSIONS = 100

  def setup
    silence_stream(STDOUT) { create_test_tables }
    generate_test_object_graphs
  end

  def create_test_tables
    conn = ActiveRecord::Base.connection

    [:circles, :squares, :triangles, :non_poly_ones, :non_poly_twos].each do |t|
      conn.create_table(t, :force => true) { }
    end

    conn.create_table :shape_expressions, :force => true do |t|
      t.string  :paint_type
      t.integer :paint_id
      t.string  :shape_type
      t.integer :shape_id
    end
    conn.create_table :paint_colors, :force => true do |t|
      t.integer :non_poly_one_id
    end
    conn.create_table :paint_textures, :force => true do |t|
      t.integer :non_poly_two_id
    end
  end

  def teardown
    drop_tables
  end

  def drop_tables
    conn = ActiveRecord::Base.connection
    conn.reconnect!

    silence_stream(STDOUT) do
      [:circles, :squares, :triangles, :paint_colors, :paint_textures,
       :shape_expressions, :non_poly_ones, :non_poly_twos].each do |t|
        conn.drop_table t
      end
    end
  end

  # meant to be supplied as an ID, never returns 0
  def rand_simple
    val = (NUM_SIMPLE_OBJS * rand).round
    val == 0 ? 1 : val
  end

{'fraction_non_alphanumeric': 0.08821402747650037, 'fraction_numerical': 0.007592190889370932, 'mean_word_length': 3.1236959761549925, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '7591061', 'n_tokens_mistral': 1022, 'n_tokens_neox': 962, 'n_words': 233}