<commit_before># tags_spec.rb
#
# @author <NAME> <<EMAIL>> 
#
# $Id: tags_spec.rb,v 2a0e0435ebdc 2012/12/06 14:05:07 roberto $

require "rspec"

require "gmail/tags"

describe GMail::TagList do

  before(:each) do
    @tl = GMail::TagList.new
    @t = GMail::Tag.new("Foo")
    @tlk = [ @t ]
    @tlkl = { "Foo" => 1 }
  end

  describe "#initialize" do
    it "should define a new object" do
      @tl.should_not be_nil
    end

    it "should be of the right class of course" do
      @tl.should be_an_instance_of(GMail::TagList)
    end

    it "should have an empty Hash as .list" do
      @tl.list.should be_an_instance_of(Hash)
    end
  end

  describe "#add" do
    it "should add one element to the list" do
      @tl.add(@t1)
      @tl.keys.should eq(@tl1.keys)
      @tl.include?(@t1).should be_true
    end

    it "adding an already present Tag should increment the counter" do
      @tl.add(@t1)
      @tl.keys.should eq(@tl2.keys)
      @tl.list[@t1].should eq(2)
    end
  end

  describe "#<<" do
    it "should add one element to the list" do
      @tl << @t1
      @tl.keys.should eq(@tl1.keys)
      @tl.include?(@t1).should be_true
    end
  end

  describe "include?" do
    it "should return true for an element of the list" do
      @tl.include?(@t).should be_true
    end
  end

  describe "#keys" do
    it "should return all keys." do
      @tl.keys.should be_an_instance_of(Array)
      @tl.keys.should_not be_nil
      @tl.keys.should eq(@tlk)
    end
  end
<commit_msg>Clarify initialization and fix usage.<commit_after># tags_spec.rb
#
# @author <NAME> <<EMAIL>> 
#
# $Id: tags_spec.rb,v a7be71c82634 2012/12/06 14:05:42 roberto $

require "rspec"

require "gmail/tags"

describe GMail::TagList do

  before(:each) do
    @tl = GMail::TagList.new

    @t1 = GMail::Tag.new("Foo")
    @t2 = GMail::Tag.new("Bar/Baz")
    @t3 = GMail::Tag.new("Bip")

    @tl1 = @tl.dup.add(@t1)
    @tl2 = @tl1.dup.add(@t2)
    @tl3 = @tl2.dup.add(@t3)

    @tlk1 = [ @t1 ]
    @tlk2 = [ @t1, @t2 ]
    @tlk3 = [ @t1, @t2, @t3 ]

    @tll1 = { @t => 1 }
    @tll2 = { @t => 2 }
  end

  describe "#initialize" do
    it "should define a new object" do
      @tl.should_not be_nil
    end

    it "should be of the right class of course" do
      @tl.should be_an_instance_of(GMail::TagList)
    end

    it "should have an empty Hash as .list" do
      @tl.list.should be_an_instance_of(Hash)
    end
  end

  describe "#add" do
    it "should add one element to the list" do
      @tl.add(@t1)
      @tl.keys.should eq(@tl1.keys)
      @tl.include?(@t1).should be_true
    end

    it "adding an already present Tag should increment the counter" do
      @tl.add(@t1)
      @tl.keys.should eq(@tl2.keys)
      @tl.list[@t1].should eq(2)
    end
  end

  describe "#<<" do
    it "should add one element to the list" do
      @tl << @t1
      @tl.keys.should eq(@tl1.keys)
      @tl.include?(@t1).should be_true
    end
  end

  describe "include?" do
    it "should return true for an element of the list" do
      @tl.include?(@t1).should be_true
    end
  end

  describe "#keys" do
    it "should return all keys." do
      @tl.add(@t1)
      @tl.keys.should be_an_instance_of(Array)
      @tl.keys.should_not be_nil
      @tl.keys.should eq(@tlk3)
    end
  end

{'fraction_non_alphanumeric': 0.13628048780487806, 'fraction_numerical': 0.027439024390243903, 'mean_word_length': 2.468287526427061, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 12, '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': '4693759', 'n_tokens_mistral': 1315, 'n_tokens_neox': 1258, 'n_words': 343}