<commit_before># Licensed under an MIT open source license - see LICENSE


'''
Test functions for Kurtosis
'''

from unittest import TestCase

import numpy as np
import numpy.testing as npt

from ..statistics import StatMoments, StatMoments_Distance
from ._testing_data import \
    dataset1, dataset2, computed_data, computed_distances


class TestMoments(TestCase):

    def test_moments(self):
        self.tester = StatMoments(dataset1["moment0"])
        self.tester.run()

        # This simply ensures the data set will run.
        # There are subtle differences due to matching the bins
        # between the sets. So all tests are completed below

    def test_moment_distance(self):
        self.tester_dist = \
            StatMoments_Distance(dataset1["moment0"],
                                 dataset2["moment0"])
        self.tester_dist.distance_metric()

        assert np.allclose(self.tester_dist.moments1.kurtosis_hist[1],
                           computed_data['kurtosis_val'])
        assert np.allclose(self.tester_dist.moments1.skewness_hist[1],
                           computed_data['skewness_val'])

        npt.assert_almost_equal(self.tester_dist.kurtosis_distance,
                                computed_distances['kurtosis_distance'])
        npt.assert_almost_equal(self.tester_dist.skewness_distance,
                                computed_distances['skewness_distance'])
<commit_msg>Update StatMoments tests (passing); empty tests to be filled in when the testing data is updated<commit_after># Licensed under an MIT open source license - see LICENSE


'''
Test functions for Kurtosis
'''

import pytest

import numpy as np
import numpy.testing as npt

from ..statistics import StatMoments, StatMoments_Distance
from ._testing_data import \
    dataset1, dataset2, computed_data, computed_distances


def test_moments():
    tester = StatMoments(dataset1["moment0"])
    tester.run()

    # TODO: Add more test comparisons. Save the total moments over the whole
    # arrays, portions of the local arrays, and the histogram values.


def test_moments_units():
    pass


def test_moments_nonperiodic():
    pass


def test_moments_custombins():
    pass


def test_moment_distance():
    tester_dist = \
        StatMoments_Distance(dataset1["moment0"],
                             dataset2["moment0"])
    tester_dist.distance_metric()

    assert np.allclose(tester_dist.moments1.kurtosis_hist[1],
                       computed_data['kurtosis_val'])
    assert np.allclose(tester_dist.moments1.skewness_hist[1],
                       computed_data['skewness_val'])

    npt.assert_almost_equal(tester_dist.kurtosis_distance,
                            computed_distances['kurtosis_distance'])
    npt.assert_almost_equal(tester_dist.skewness_distance,
                            computed_distances['skewness_distance'])

{'fraction_non_alphanumeric': 0.0776192133658197, 'fraction_numerical': 0.008353637312913331, 'mean_word_length': 2.842245989304813, 'pattern_counts': {'":': 0, '<': 3, '<?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': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5920358', 'n_tokens_mistral': 850, 'n_tokens_neox': 810, 'n_words': 190}