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

from unittest import TestCase

import numpy.testing as npt


from ..data_reduction import Mask_and_Moments
from ._testing_data import dataset1, sc1


class test_Mask_and_Moments(TestCase):
    """docstring for test_Mask_and_Moments"""

    def test_loading(self):

        # Try loading the files.

        test = Mask_and_Moments.from_fits(sc1, moments_prefix="dataset1",
                                          moments_path=".")

        npt.assert_allclose(test.moment0, dataset1["moment0"][0])
        npt.assert_allclose(test.moment1, dataset1["centroid"][0])
        npt.assert_allclose(test.linewidth, dataset1["linewidth"][0])
        npt.assert_allclose(test.intint,
                            dataset1["integrated_intensity"][0])

        npt.assert_allclose(test.moment0, dataset1["moment0_error"][0])
        npt.assert_allclose(test.moment1, dataset1["centroid_error"][0])
        npt.assert_allclose(test.linewidth_err, dataset1["linewidth_error"][0])
        npt.assert_allclose(test.intint_err,
                            dataset1["integratedintensity_error"][0])<commit_msg>Actually test the errors<commit_after># Licensed under an MIT open source license - see LICENSE

from unittest import TestCase

import numpy.testing as npt


from ..data_reduction import Mask_and_Moments
from ._testing_data import dataset1, sc1


class test_Mask_and_Moments(TestCase):
    """docstring for test_Mask_and_Moments"""

    def test_loading(self):

        # Try loading the files.

        test = Mask_and_Moments.from_fits(sc1, moments_prefix="dataset1",
                                          moments_path=".")

        npt.assert_allclose(test.moment0, dataset1["moment0"][0])
        npt.assert_allclose(test.moment1, dataset1["centroid"][0])
        npt.assert_allclose(test.linewidth, dataset1["linewidth"][0])
        npt.assert_allclose(test.intint,
                            dataset1["integrated_intensity"][0])

        npt.assert_allclose(test.moment0_err, dataset1["moment0_error"][0])
        npt.assert_allclose(test.moment1_err, dataset1["centroid_error"][0])
        npt.assert_allclose(test.linewidth_err, dataset1["linewidth_error"][0])
        npt.assert_allclose(test.intint_err,
                            dataset1["integratedintensity_error"][0])
{'fraction_non_alphanumeric': 0.10606703436571914, 'fraction_numerical': 0.02206194314806958, 'mean_word_length': 3.166077738515901, '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': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3295207', 'n_tokens_mistral': 737, 'n_tokens_neox': 701, 'n_words': 118}