<commit_before>RSpec::Matchers.define :subclass_genomer_output_type do
  match do |actual|
    actual.superclass == Genomer::OutputType
  end

  description do |actual|
    "#{actual} should subclass Genomer::OutputType"
  end
end

RSpec::Matchers.define :define_the_suffix_constant_as do |expected|
  match do |actual|
    actual.const_get('SUFFIX').should == expected
  end
end

RSpec::Matchers.define :generate_the_sequence do |expected|
  match do |outputter|
    output = outputter.generate
    raise ArgumentError.new("Generated output is nil") if output.nil?
    sequence = Bio::FlatFile.auto(StringIO.new(output)){ |out| out.first.seq }
    sequence == expected
  end
end<commit_msg>Refactor macros to be diffable<commit_after>RSpec::Matchers.define :subclass_genomer_output_type do
  match do |actual|
    actual.superclass == Genomer::OutputType
  end

  description do |actual|
    "#{actual} should subclass Genomer::OutputType"
  end
end

RSpec::Matchers.define :define_the_suffix_constant_as do |expected|
  match do |a|
    self.instance_variable_set(:@actual, a.const_get('SUFFIX'))
    actual == expected
  end
  diffable
end

RSpec::Matchers.define :generate_the_sequence do |expected|
  match do |outputter|
    output = outputter.generate
    raise ArgumentError.new("Generated output is nil") if output.nil?
    sequence = Bio::FlatFile.auto(StringIO.new(output)){ |out| out.first.seq }

    self.instance_variable_set(:@actual, sequence.upcase)
    self.instance_variable_set(:@expected, expected.upcase)
    actual == expected
  end
  diffable
end
{'fraction_non_alphanumeric': 0.10509554140127389, 'fraction_numerical': 0.0, 'mean_word_length': 4.818518518518519, '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': '6940796', 'n_tokens_mistral': 502, 'n_tokens_neox': 495, 'n_words': 117}