<commit_before>require_relative 'execution_assay'

# Assert that a kind of exception class is rescued
# from the execution of a block.
#
class RescueAssay < ExecutionAssay

  register :rescue

  #
  # Check assertion.
  #
  def self.pass?(*exceptions)
    exceptions = [Exception] if exceptions.empty?
    begin
      yield
      false
    rescue Exception => e
      exceptions.any? do |x|
        x === e
      end
    end
  end

  #
  # Check negated assertion.
  #
  def self.fail?(*exceptions)
    exceptions = [Exception] if exceptions.empty?
    begin
      yield<commit_msg>RescueAssay is not a subclass of ExecutionAssay.<commit_after>require_relative 'assertion'

# Assert that a kind of exception class is rescued
# from the execution of a block.
#
class RescueAssay < Assertion

  register :rescue

  #
  # Check assertion.
  #
  def self.pass?(*exceptions)
    exceptions = [Exception] if exceptions.empty?
    begin
      yield
      false
    rescue Exception => e
      exceptions.any? do |x|
        x === e
      end
    end
  end

  #
  # Check negated assertion.
  #
  def self.fail?(*exceptions)
    exceptions = [Exception] if exceptions.empty?
    begin
      yield
{'fraction_non_alphanumeric': 0.08164983164983165, 'fraction_numerical': 0.0, 'mean_word_length': 2.5813253012048194, 'pattern_counts': {'":': 0, '<': 5, '<?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': '630911', 'n_tokens_mistral': 374, 'n_tokens_neox': 361, 'n_words': 115}