<commit_before>require 'helper'

class TestJrubyStreamingUpdateSolrServer < Test::Unit::TestCase
  should "Write some tests, but don't know how to mock up a solr server" do
    assert_equal 1, 1
  end

  should "Report nil for a document that doesn't include a field" do 
    doc = SolrInputDocument.new
    assert_equal nil, doc[:notinthere]
  end
  
  should "Return single and multiple values in arrays" do
    doc = SolrInputDocument.new
    doc << [:id, 1]
    assert_equal [1], doc[:id]
    doc << [:id, 2]
    assert_equal [1,2], doc[:id]
  end
  
  should "Add items in hash via merge!" do
    doc = SolrInputDocument.new
    doc << [:id, 1]
    h = {:id => 2, :name => 'Bill'}
    doc.merge! h
    assert_equal [1,2], doc[:id]
    assert_equal ['Bill'], doc[:name]
  end
  
  should "Destroy existing items via []=" do
    doc = SolrInputDocument.new
    doc[:id] = 1
    assert_equal [1], doc[:id]
    doc[:id] = 2
    assert_equal [2], doc[:id]
  end    
    

end<commit_msg>Added little spec for additive_merge\!<commit_after>require 'helper'

class TestJrubyStreamingUpdateSolrServer < Test::Unit::TestCase
  should "Write some tests, but don't know how to mock up a solr server" do
    assert_equal 1, 1
  end

  should "Report nil for a document that doesn't include a field" do 
    doc = SolrInputDocument.new
    assert_equal nil, doc[:notinthere]
  end
  
  should "Return single and multiple values in arrays" do
    doc = SolrInputDocument.new
    doc << [:id, 1]
    assert_equal [1], doc[:id]
    doc << [:id, 2]
    assert_equal [1,2], doc[:id]
  end
  
  should "Add items in hash via merge!" do
    doc = SolrInputDocument.new
    doc << [:id, 1]
    h = {:id => 2, :name => 'Bill'}
    doc.merge! h
    assert_equal [1,2], doc[:id]
    assert_equal ['Bill'], doc[:name]
  end
  
  should "Allow additive_merge! as well" do
    doc = SolrInputDocument.new
    doc << [:id, 1]
    h = {:id => 2, :name => 'Bill'}
    doc.additive_merge! h
    assert_equal [1,2], doc[:id]
    assert_equal ['Bill'], doc[:name]
    
  end
  
  should "Destroy existing items via []=" do
    doc = SolrInputDocument.new
    doc[:id] = 1
    assert_equal [1], doc[:id]
    doc[:id] = 2
    assert_equal [2], doc[:id]
  end    
    

end
{'fraction_non_alphanumeric': 0.12578055307760927, 'fraction_numerical': 0.015165031222123104, 'mean_word_length': 2.9213286713286712, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 9, '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': '3426808', 'n_tokens_mistral': 808, 'n_tokens_neox': 772, 'n_words': 254}