<commit_before>require 'spec_helper'

describe 'DOT rendering' do
  it 'should render for an empty scope' do
    Tag.to_dot_digraph(Tag.where("0=1")).should == "digraph G {\n}\n"
  end
  it 'should render for an empty scope' do
    Tag.find_or_create_by_path(%w(a b1 c1))
    Tag.find_or_create_by_path(%w(a b2 c2))
    Tag.find_or_create_by_path(%w(a b2 c3))
    dot = Tag.roots.first.to_dot_digraph
    dot.should == <<-DOT
digraph G {
  1 [label="a"]
  1 -> 2
  2 [label="b1"]
  1 -> 4
  4 [label="b2"]
  2 -> 3
  3 [label="c1"]
  4 -> 5
  5 [label="c2"]
  4 -> 6
  6 [label="c3"]
}
    DOT
  end
end
<commit_msg>stable IDs<commit_after>require 'spec_helper'

describe 'DOT rendering' do
  it 'should render for an empty scope' do
    Tag.to_dot_digraph(Tag.where("0=1")).should == "digraph G {\n}\n"
  end
  it 'should render for an empty scope' do
    Tag.find_or_create_by_path(%w(a b1 c1))
    Tag.find_or_create_by_path(%w(a b2 c2))
    Tag.find_or_create_by_path(%w(a b2 c3))
    a, b1, b2, c1, c2, c3 = %w(a b1 b2 c1 c2 c3).map { |ea| Tag.where(:name => ea).first.id }
    dot = Tag.roots.first.to_dot_digraph
    dot.should == <<-DOT
digraph G {
  #{a} [label="a"]
  #{a} -> #{b1}
  #{b1} [label="b1"]
  #{a} -> #{b2}
  #{b2} [label="b2"]
  #{b1} -> #{c1}
  #{c1} [label="c1"]
  #{b2} -> #{c2}
  #{c2} [label="c2"]
  #{b2} -> #{c3}
  #{c3} [label="c3"]
}
    DOT
  end
end

{'fraction_non_alphanumeric': 0.1936416184971098, 'fraction_numerical': 0.04696531791907514, 'mean_word_length': 3.1097922848664687, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '312519', 'n_tokens_mistral': 641, 'n_tokens_neox': 645, 'n_words': 150}