<commit_before>module GUnit
  
  class Verification
    attr_writer :message
    attr_accessor :expected, :actual
    
    # Verification.new(true, "message")
    # Verification.new(true)
    # Verification.new("message") { true }
    def initialize(*args, &blk)
      # args.flatten! # TODO may need to be smarter about when this happens
      if blk
        self.actual  = blk
        self.message = args[0] 
      else
        self.actual  = args[0]
        self.message = args[1]
      end
      self.expected = true
    end
    
    def run(parent=nil)
      begin
        response = if self.matches?
          PassResponse.new
        else
          FailResponse.new
        end
      rescue ::StandardError => e
        response = ExceptionResponse.new
      end
      response
    end
    
    
    def message
      @message || default_message
    end
    
    def matches?
      if @actual.is_a?(Proc)
        returned = @actual[self]
        returned == @expected || returned.is_a?(PassResponse)
      else
        @actual == @expected
      end
    end
    
    def default_message
      "Verification failed!"
    end
    
  end
  
end

<commit_msg>Clean up Verification<commit_after>module GUnit
  
  class Verification
    attr_writer :message
    attr_accessor :expected, :actual
    
    # Verification.new(true, "message")
    # Verification.new(true)
    # Verification.new("message") { true }
    def initialize(*args, &blk)
      # args.flatten! # TODO may need to be smarter about when this happens
      if blk
        self.actual  = blk
        self.message = args[0] 
      else
        self.actual  = args[0]
        self.message = args[1]
      end
      self.expected = true
    end
    
    def run
      begin
        response = if self.matches?
          PassResponse.new
        else
          FailResponse.new
        end
      rescue ::StandardError => e
        response = ExceptionResponse.new
      end
      response
    end
    
    def message
      @message || default_message
    end
    
    def matches?
      if @actual.is_a?(Proc)
        @actual.call == @expected
      else
        @actual == @expected
      end
    end
    
    def default_message
      "Verification failed!"
    end
    
  end
  
end


{'fraction_non_alphanumeric': 0.07852706299911269, 'fraction_numerical': 0.0026619343389529724, 'mean_word_length': 1.713598074608905, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '484191', 'n_tokens_mistral': 661, 'n_tokens_neox': 662, 'n_words': 173}