<commit_before>require 'helper'
class TestRelationStateable < Test::Unit::TestCase
  class AnObject
    include Sower::Relation::Stateable
  end

  def setup
    @object = AnObject.new
    assert(node = Sower::Node.new(:node))
    assert(@table = Sower::Relation::Table.new(node))
    @attribute = Sower::Relation::Attribute.new(@table, :name)
    @value = Sower::Relation::Value.in(['john', 'edward'])
    @statement = Sower::Relation::Statement.new(@attribute,@value)
  end

  context "A Stateable object" do
    should "respond to statement" do
      assert_respond_to @object, :statement
      assert_nil @object.statement
      @object.where(@statement)
      assert_equal @statement, @object.statement
    end

    should "respond to where" do
      assert_respond_to @object, :where
    end

    should "respond to or" do
      assert_respond_to @object, :or
    end

    should "respond to and" do
      assert_respond_to @object, :and
    end
  end<commit_msg>test to_sql on a Stateable Object<commit_after>require 'helper'
class TestRelationStateable < Test::Unit::TestCase
  class AnObject
    include Sower::Relation::Stateable
  end

  def setup
    @object = AnObject.new
    assert(node = Sower::Node.new(:node))
    assert(@table = Sower::Relation::Table.new(node))
    @attribute = Sower::Relation::Attribute.new(@table, :name)
    @value = Sower::Relation::Value.in(['john', 'edward'])
    @statement = Sower::Relation::Statement.new(@attribute,@value)
  end

  context "A Stateable object" do
    should "respond to statement" do
      assert_respond_to @object, :statement
      assert_nil @object.statement
      @object.where(@statement)
      assert_equal @statement, @object.statement
    end

    should "respond to where" do
      assert_respond_to @object, :where
    end

    should "respond to or" do
      assert_respond_to @object, :or
    end

    should "respond to and" do
      assert_respond_to @object, :and
    end

    should "respond to to_sql" do
      assert_nil @object.to_sql
    end
  end
{'fraction_non_alphanumeric': 0.11018199704869651, 'fraction_numerical': 0.0, 'mean_word_length': 3.5401785714285716, 'pattern_counts': {'":': 0, '<': 5, '<?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': '3287656', 'n_tokens_mistral': 633, 'n_tokens_neox': 619, 'n_words': 162}