<commit_before># this file generated by script/generate pickle

# create a model
Given(/^#{capture_model} exists?(?: with #{capture_fields})?$/) do |name, fields|
  create_model(name, fields)
end

# create n models
Given(/^(\d+) #{capture_plural_factory} exist(?: with #{capture_fields})?$/) do |count, plural_factory, fields|
  count.to_i.times { create_model(plural_factory.singularize, fields) }
end

# create models from a table
Given(/^the following #{capture_plural_factory} exists?:?$/) do |plural_factory, table|
  create_models_from_table(plural_factory, table)
end

# find a model
Then(/^#{capture_model} should exist(?: with #{capture_fields})?$/) do |name, fields|
  find_model!(name, fields)
end

# not find a model
Then(/^#{capture_model} should not exist(?: with #{capture_fields})?$/) do |name, fields|
  expect(find_model(name, fields)).to be_nil
end

# find models with a table
Then(/^the following #{capture_plural_factory} should exists?:?$/) do |plural_factory, table|
  expect(find_models_from_table(plural_factory, table)).not_to be_any(&:nil?)
end

# find exactly n models
Then(/^(\d+) #{capture_plural_factory} should exist(?: with #{capture_fields})?$/) do |count, plural_factory, fields|
  expect(find_models(plural_factory.singularize, fields).size).to eq(count.to_i)
end

# assert equality of models
Then(/^#{capture_model} should be #{capture_model}$/) do |a, b|
  expect(model!(a)).to eq(model!(b))
end

# assert model is in another model's has_many assoc
Then(/^#{capture_model} should be (?:in|one of|amongst) #{capture_model}(?:'s)? (\w+)$/) do |target, owner, association|
  expect(model!(owner).send(association)).to include(model!(target))
end

# assert model is not in another model's has_many assoc
Then(/^#{capture_model} should not be (?:in|one of|amongst) #{capture_model}(?:'s)? (\w+)$/) do |target, owner, association|
  expect(model!(owner).send(association)).not_to include(model!(target))
end

# assert model is another model's has_one/belongs_to assoc
Then(/^#{capture_model} should be #{capture_model}(?:'s)? (\w+)$/) do |target, owner, association|
  expect(model!(owner).send(association)).to eq(model!(target))
end

# assert model is not another model's has_one/belongs_to assoc
Then(/^#{capture_model} should not be #{capture_model}(?:'s)? (\w+)$/) do |target, owner, association|
  expect(model!(owner).send(association)).not_to eq(model!(target))
end

# assert model.predicate? 
Then(/^#{capture_model} should (?:be|have) (?:an? )?#{capture_predicate}$/) do |name, predicate|
  if model!(name).respond_to?("has_#{predicate.gsub(' ', '_')}")
    expect(model!(name)).to send("have_#{predicate.gsub(' ', '_')}")
  else
    expect(model!(name)).to send("be_#{predicate.gsub(' ', '_')}")
  end
end

# assert not model.predicate?
Then(/^#{capture_model} should not (?:be|have) (?:an? )?#{capture_predicate}$/) do |name, predicate|
  if model!(name).respond_to?("has_#{predicate.gsub(' ', '_')}")
    expect(model!(name)).not_to send("have_#{predicate.gsub(' ', '_')}")
  else
    expect(model!(name)).not_to send("be_#{predicate.gsub(' ', '_')}")
  end
end

# expect(model.attribute).to eq(value)
# expect(model.attribute).not_to eq(value)
Then(/^#{capture_model}'s (\w+) (should(?: not)?) be #{capture_value}$/) do |name, attribute, expectation, expected|
  actual_value  = model(name).send(attribute)
  expectation   = expectation.gsub("should", "to").gsub(" ", "_")
  
  case expected
  when 'nil', 'true', 'false'
    expect(actual_value).send(expectation, eq(eval(expected)))
  when /^[+-]?[0-9_]+(\.\d+)?$/
    expect(actual_value).send(expectation, eq(expected.to_f))
  else
    expect(actual_value.to_s).send(expectation, eq(eval(expected)))
  end
end
<commit_msg>No plural possible here<commit_after># this file generated by script/generate pickle

# create a model
Given(/^#{capture_model} exists?(?: with #{capture_fields})?$/) do |name, fields|
  create_model(name, fields)
end

# create n models
Given(/^(\d+) #{capture_plural_factory} exist(?: with #{capture_fields})?$/) do |count, plural_factory, fields|
  count.to_i.times { create_model(plural_factory.singularize, fields) }
end

# create models from a table
Given(/^the following #{capture_plural_factory} exists?:?$/) do |plural_factory, table|
  create_models_from_table(plural_factory, table)
end

# find a model
Then(/^#{capture_model} should exist(?: with #{capture_fields})?$/) do |name, fields|
  find_model!(name, fields)
end

# not find a model
Then(/^#{capture_model} should not exist(?: with #{capture_fields})?$/) do |name, fields|
  expect(find_model(name, fields)).to be_nil
end

# find models with a table
Then(/^the following #{capture_plural_factory} should exist:?$/) do |plural_factory, table|
  expect(find_models_from_table(plural_factory, table)).not_to be_any(&:nil?)
end

# find exactly n models
Then(/^(\d+) #{capture_plural_factory} should exist(?: with #{capture_fields})?$/) do |count, plural_factory, fields|
  expect(find_models(plural_factory.singularize, fields).size).to eq(count.to_i)
end

# assert equality of models
Then(/^#{capture_model} should be #{capture_model}$/) do |a, b|
  expect(model!(a)).to eq(model!(b))
end

# assert model is in another model's has_many assoc
Then(/^#{capture_model} should be (?:in|one of|amongst) #{capture_model}(?:'s)? (\w+)$/) do |target, owner, association|
  expect(model!(owner).send(association)).to include(model!(target))
end

# assert model is not in another model's has_many assoc
Then(/^#{capture_model} should not be (?:in|one of|amongst) #{capture_model}(?:'s)? (\w+)$/) do |target, owner, association|
  expect(model!(owner).send(association)).not_to include(model!(target))
end

# assert model is another model's has_one/belongs_to assoc
Then(/^#{capture_model} should be #{capture_model}(?:'s)? (\w+)$/) do |target, owner, association|
  expect(model!(owner).send(association)).to eq(model!(target))
end

# assert model is not another model's has_one/belongs_to assoc
Then(/^#{capture_model} should not be #{capture_model}(?:'s)? (\w+)$/) do |target, owner, association|
  expect(model!(owner).send(association)).not_to eq(model!(target))
end

# assert model.predicate?
Then(/^#{capture_model} should (?:be|have) (?:an? )?#{capture_predicate}$/) do |name, predicate|
  if model!(name).respond_to?("has_#{predicate.gsub(' ', '_')}")
    expect(model!(name)).to send("have_#{predicate.gsub(' ', '_')}")
  else
    expect(model!(name)).to send("be_#{predicate.gsub(' ', '_')}")
  end
end

# assert not model.predicate?
Then(/^#{capture_model} should not (?:be|have) (?:an? )?#{capture_predicate}$/) do |name, predicate|
  if model!(name).respond_to?("has_#{predicate.gsub(' ', '_')}")
    expect(model!(name)).not_to send("have_#{predicate.gsub(' ', '_')}")
  else
    expect(model!(name)).not_to send("be_#{predicate.gsub(' ', '_')}")
  end
end

# expect(model.attribute).to eq(value)
# expect(model.attribute).not_to eq(value)
Then(/^#{capture_model}'s (\w+) (should(?: not)?) be #{capture_value}$/) do |name, attribute, expectation, expected|
  actual_value  = model(name).send(attribute)
  expectation   = expectation.gsub("should", "to").gsub(" ", "_")

  case expected
  when 'nil', 'true', 'false'
    expect(actual_value).send(expectation, eq(eval(expected)))
  when /^[+-]?[0-9_]+(\.\d+)?$/
    expect(actual_value).send(expectation, eq(expected.to_f))
  else
    expect(actual_value.to_s).send(expectation, eq(eval(expected)))
  end
end

{'fraction_non_alphanumeric': 0.1915693381661968, 'fraction_numerical': 0.0005369848301785474, 'mean_word_length': 6.170356111645813, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3864414', 'n_tokens_mistral': 2560, 'n_tokens_neox': 2574, 'n_words': 591}