<commit_before>require 'spec_helper'

describe 'CypherTranslator' do
  let(:klass) { Class.new.extend Neo4j::Core::CypherTranslator }

  context '#sanitize_escape_sequences' do
    context 'with valid strings' do
      [ 
        'a\\\\p',
        'a\b',
        'a\tb',
        'a\bb',
        'a\nb',
        'a\rb',
        'a\fb',
        'a\'b',
        'a\"b',
        "a\b",
        '\u00b5',
        "\u00b5",
      ].each do |s|
        it "does not change #{s}" do
          klass.sanitize_escape_sequences(s).should == s
        end
      end
    end

    context 'with invalid strings' do
      {
        'a\pb'    => 'apb',
        '2\56'    => '256',
      }.each do |before, after|
        it "replaces #{before} with #{after}" do
          klass.sanitize_escape_sequences(before).should == after
        end
      end
    end

  end

end<commit_msg>add spec<commit_after>require 'spec_helper'

describe 'CypherTranslator' do
  let(:klass) { Class.new.extend Neo4j::Core::CypherTranslator }

  context '#sanitize_escape_sequences' do
    context 'with valid strings' do
      [
        'a\\\\p',
        'a\b',
        'a\tb',
        'a\bb',
        'a\nb',
        'a\rb',
        'a\fb',
        'a\'b',
        'a\"b',
        "a\b",
        '\u00b5',
        "\u00b5",
      ].each do |s|
        it "does not change #{s}" do
          klass.sanitize_escape_sequences(s).should == s
        end
      end
    end

    context 'with invalid strings' do
      {
        'a\pb'    => 'apb',
        '2\56'    => '256',
      }.each do |before, after|
        it "replaces #{before} with #{after}" do
          klass.sanitize_escape_sequences(before).should == after
        end
      end
    end

  end

  context "#cyper_prop_list" do
    it "drops nil properties" do
      items = klass.cypher_prop_list({one: 1, two: 2, three: nil})
      items.should == "{one : 1,two : 2}"
    end
  end

end
{'fraction_non_alphanumeric': 0.14950339780449556, 'fraction_numerical': 0.015682174594877155, 'mean_word_length': 1.654646324549237, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '4921907', 'n_tokens_mistral': 703, 'n_tokens_neox': 676, 'n_words': 157}