<commit_before>"""
Tests functions in smoothing.py
Run with:
    nosetests test_smoothing.py
"""	

# Test method .smooth()
smooth1, smooth2 = subtest_runtest1.smooth(0), subtest_runtest1.smooth(1, 5)
smooth3 = subtest_runtest1.smooth(2, 0.25)
assert [smooth1.max(), smooth1.shape, smooth1.sum()] == [0, (3, 3, 3), 0]
assert [smooth2.max(), smooth2.shape, smooth2.sum()] == [1, (3, 3, 3), 27]
assert [smooth3.max(), smooth3.shape, smooth3.sum()] == [8, (3, 3, 3), 108]
assert [smooth1.std(), smooth2.std()] == [0, 0]
assert_almost_equal(smooth3.std(), 1.6329931618554521)<commit_msg>Add seperate test function for smoothing.py<commit_after>"""
==================Test file for smoothing.py======================

Test convolution module, hrf function and convolve function

Run with:
		nosetests nosetests code/tests/test_smoothing.py


"""

from __future__ import absolute_import, division, print_function
from nose.tools import assert_equal
from numpy.testing import assert_almost_equal, assert_array_equal
import numpy as np
import sys

sys.path.append("code/utils")
from smoothing import *
import make_class

subtest_runtest1 = make_class.run("test", "001", filtered_data=True)

# Test method .smooth()
smooth1, smooth2 = subtest_runtest1.smooth(0), subtest_runtest1.smooth(1, 5)
smooth3 = subtest_runtest1.smooth(2, 0.25)
assert [smooth1.max(), smooth1.shape, smooth1.sum()] == [0, (3, 3, 3), 0]
assert [smooth2.max(), smooth2.shape, smooth2.sum()] == [1, (3, 3, 3), 27]
assert [smooth3.max(), smooth3.shape, smooth3.sum()] == [8, (3, 3, 3), 108]
assert [smooth1.std(), smooth2.std()] == [0, 0]
assert_almost_equal(smooth3.std(), 1.6329931618554521)
{'fraction_non_alphanumeric': 0.18159806295399517, 'fraction_numerical': 0.0774818401937046, 'mean_word_length': 6.034042553191489, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4304644', 'n_tokens_mistral': 679, 'n_tokens_neox': 595, 'n_words': 152}