<commit_before>module Expectations
  class SimpleContext
    include Dill::DSL
    include RSpec::Matchers

    attr_reader :env

    def eval_expectation(code, b)
      setup, result = code.split('#=>').map(&:strip)

      expect(eval(setup, b)).to eq eval(result, b)
    end

    def eval_expectations(code)
      setup, result = code.split(/\n\n/)

      eval setup, canvas

      result.split("\n").each { |e| eval_expectation e, canvas }
    end

    def canvas
      @canvas ||= binding
    end
  end

  class PageContext < SimpleContext
    attr_reader :page

    def initialize(page = "/test")
      @page = page
<commit_msg>[tests] Fix stupid error.<commit_after>module Expectations
  class SimpleContext
    include Dill::DSL
    include RSpec::Matchers

    attr_reader :env

    def eval_expectation(code, b = nil)
      setup, result = code.split('#=>').map(&:strip)

      expect(eval(*[setup, b].compact)).to eq eval(*[result, b].compact)
    end

    def eval_expectations(code)
      setup, result = code.split(/\n\n/)

      eval setup, canvas

      result.split("\n").each { |e| eval_expectation e, canvas }
    end

    def canvas
      @canvas ||= binding
    end
  end

  class PageContext < SimpleContext
    attr_reader :page

    def initialize(page = "/test")
      @page = page

{'fraction_non_alphanumeric': 0.12098009188361408, 'fraction_numerical': 0.0, 'mean_word_length': 2.6816901408450704, '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': '2468548', 'n_tokens_mistral': 420, 'n_tokens_neox': 398, 'n_words': 108}