<commit_before>require_relative 'helper'

class Test_Striuct_Subclass_Instance_Assign < Test::Unit::TestCase

  Sth = Striuct.new do
    member :foo
  end  

  def test_unassign
    sth = Sth.new
    assert_equal false, sth.assign?(:foo)
    sth.foo = nil
    assert_equal true, sth.assign?(:foo)
    sth.unassign :foo
    assert_equal false, sth.assign?(:foo)
    sth.foo = nil
    assert_equal true, sth.assign?(:foo)
    sth.clear_at 0
    assert_equal false, sth.assign?(:foo)
    
    assert_raises NameError do
      sth.unassign :var
    end
    
    assert_raises IndexError do
      sth.unassign 1
    end
  end

end<commit_msg>modify test-case (#54)<commit_after>require_relative 'helper'

class Test_Striuct_Subclass_Instance_Assign < Test::Unit::TestCase

  Sth = Striuct.new do
    member :foo
  end  

  [:unassign, :delete_at].each do |method|
    define_method :"test_#{method}" do
      sth = Sth.new
      assert_equal false, sth.assign?(:foo)
      sth.foo = nil
      assert_equal true, sth.assign?(:foo)
      sth.public_send method, :foo
      assert_equal false, sth.assign?(:foo)
      sth.foo = nil
      assert_equal true, sth.assign?(:foo)
      sth.public_send method, 0
      assert_equal false, sth.assign?(:foo)
      
      assert_raises NameError do
        sth.public_send method,  :var
      end
      
      assert_raises IndexError do
        sth.public_send method,  1
      end
    end
  end

end
{'fraction_non_alphanumeric': 0.09198606271777003, 'fraction_numerical': 0.004181184668989547, 'mean_word_length': 2.6726342710997444, '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': '1850001', 'n_tokens_mistral': 518, 'n_tokens_neox': 505, 'n_words': 115}