<commit_before>require File.dirname(__FILE__) + '/test_helper'

class PageTermsTest < ActiveSupport::TestCase
  fixtures :users

  def setup
  end

  def test_create
    user = users(:blue)
    page = DiscussionPage.create! :title => 'hi', :user => user
    assert_equal Page.access_ids_for(:user_ids => [user.id]).first, page.page_terms.access_ids
  end

  def test_tagging_with_odd_characters
    name = 'test page'
    page = WikiPage.make :title => name.titleize, :name => name.nameize
    page.tag_list = "^&#, +, **, %, ə"
    page.save!

    "^&#, +, **, %, ə".split(', ').each do |char|
      found = Page.find_by_path(['tag', char]).first
      assert found, 'there should be a page tagged %s' % char
      assert_equal page.id, found.id, 'the page ids should match for tag %s' % char
    end
  end

  protected

end<commit_msg>declare utf-8 encoding for special chars in this file<commit_after># encoding: utf-8

require File.dirname(__FILE__) + '/test_helper'

class PageTermsTest < ActiveSupport::TestCase
  fixtures :users

  def setup
  end

  def test_create
    user = users(:blue)
    page = DiscussionPage.create! :title => 'hi', :user => user
    assert_equal Page.access_ids_for(:user_ids => [user.id]).first, page.page_terms.access_ids
  end

  def test_tagging_with_odd_characters
    name = 'test page'
    page = WikiPage.make :title => name.titleize, :name => name.nameize
    page.tag_list = "^&#, +, **, %, ə"
    page.save!

    "^&#, +, **, %, ə".split(', ').each do |char|
      found = Page.find_by_path(['tag', char]).first
      assert found, 'there should be a page tagged %s' % char
      assert_equal page.id, found.id, 'the page ids should match for tag %s' % char
    end
  end

  protected

end
{'fraction_non_alphanumeric': 0.13964223889209462, 'fraction_numerical': 0.001154068090017311, 'mean_word_length': 3.367758186397985, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, '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': '2958010', 'n_tokens_mistral': 603, 'n_tokens_neox': 584, 'n_words': 156}