<commit_before>require 'test_helper'
require 'cascadable'

class JeDIcdChapterAgeSexParserTest < ActiveSupport::TestCase

  def setup
    @parser = JeIcdChapterAgeSexParser.new('./test/fixtures/je-d-icd-chapters.xls')
    @results = @parser.parse
  end

  def test_first_dataset
    dataset = @results.first
    assert_equal("I", dataset.code)
    assert_equal(2013, dataset.year)

    data = dataset.categorised_data.at(:icd_chapter_sex_interval).first
    assert_not_nil(data)

    assert_equal(3.41280659, data.percentage)
    assert_equal(4.1929361, data.number)
    assert_equal(2, data.sex)
    assert_equal(Interval.new(from: 0,to: 14), data.interval)
  end

  def test_last_dataset
    dataset = @results.last
    assert_equal("XXI", dataset.code)
    assert_equal(2003, dataset.year)

    data = dataset.categorised_data.at(:icd_chapter_sex_interval).first
    assert_not_nil(data)

    assert_equal(12.6, data.percentage)
    assert_equal(25, data.number)
    assert_equal(0, data.sex)
    assert_equal(Interval.new(from: 0), data.interval)
  end

end<commit_msg>Fixed a failing unit test<commit_after>require 'test_helper'
require 'cascadable'

class JeDIcdChapterAgeSexParserTest < ActiveSupport::TestCase

  def setup
    @parser = JeIcdChapterAgeSexParser.new('./test/fixtures/je-d-icd-chapters.xls')
    @results = @parser.parse
  end

  def test_first_dataset
    dataset = @results.first
    assert_equal("I", dataset.code)
    assert_equal(2013, dataset.year)

    data = dataset.categorised_data.at(:icd_chapter_sex_interval).first
    assert_not_nil(data)

    assert_equal(3.41280659, data.percentage)
    assert_equal(4.1929361, data.number)
    assert_equal(2, data.sex)
    assert_equal(Interval.new(from: 0,to: 14), data.interval)
  end

  def test_last_dataset
    dataset = @results.last
    assert_equal("XXI", dataset.code)
    assert_equal(2003, dataset.year)

    data = dataset.categorised_data.at(:icd_chapter_sex_interval).first
    assert_not_nil(data)

    assert_equal(12.6, data['percentage'])
    assert_equal(25, data['number'])
    assert_equal(0, data['sex'])
    assert_equal(0, data['interval']['from'])
  end

end
{'fraction_non_alphanumeric': 0.11492122335495829, 'fraction_numerical': 0.033364226135310475, 'mean_word_length': 4.4110275689223055, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '1115658', 'n_tokens_mistral': 810, 'n_tokens_neox': 742, 'n_words': 118}