<commit_before>from __future__ import absolute_import

import unittest
from flask import Flask

from .. import config

app = Flask('__config_test')


class GetFuncsTest(unittest.TestCase):
    """All tests for get funcs function."""

    def test_get_module_funcs(self):
        """Test the return value."""
        self.assertIsInstance(config._get_funcs('__main__'), dict)


class InjectFiltersTest(unittest.TestCase):
    """All tests for inject filters function."""

    def test_inject_filters_inst(self):
        """Test the return value."""
        self.assertIsInstance(config._inject_filters(app, {}), Flask)

    def test_inject_filters_count(self):
        """Test the return value."""
        old = len(app.jinja_env.filters)
        config._inject_filters(app, {'foo': lambda x: x})
        new = len(app.jinja_env.filters)
        self.assertGreater(new, old)
        assert 'foo' in app.jinja_env.filters


class ConfigFlaskFiltersTest(unittest.TestCase):
    """All tests for config flask filters function."""

    def test_config_filters_inst(self):
        """Test the return value."""
        self.assertIsInstance(config.config_flask_filters(app), Flask)

    def test_config_filters_count(self):
        """Test the return value."""
        old = len(app.jinja_env.filters)
        config.config_flask_filters(app)
        new = len(app.jinja_env.filters)
        self.assertGreater(new, old)
<commit_msg>Remove protected class access, add module docstrings.<commit_after>"""Test configuration utilities."""

from __future__ import absolute_import

import unittest
from flask import Flask

from .. import config

app = Flask('__config_test')


class GetFuncsTest(unittest.TestCase):
    """All tests for get funcs function."""

    def test_get_module_funcs(self):
        """Test the return value."""
        self.assertIsInstance(config._get_funcs(config), dict)

    def test_get_module_funcs_notempty(self):
        """Test the return value functions length."""
        self.assertGreater(len(config._get_funcs(config).items()), 0)


class InjectFiltersTest(unittest.TestCase):
    """All tests for inject filters function."""

    def test_inject_filters_inst(self):
        """Test the return value."""
        self.assertIsInstance(config._inject_filters(app, {}), Flask)

    def test_inject_filters_count(self):
        """Test the return value."""
        old = len(app.jinja_env.filters)
        config._inject_filters(app, {'foo': lambda x: x})
        new = len(app.jinja_env.filters)
        self.assertGreater(new, old)
        assert 'foo' in app.jinja_env.filters


class ConfigFlaskFiltersTest(unittest.TestCase):
    """All tests for config flask filters function."""

    def test_config_filters_inst(self):
        """Test the return value."""
        self.assertIsInstance(config.config_flask_filters(app), Flask)

    def test_config_filters_count(self):
        """Test the return value."""
        old = len(app.jinja_env.filters)
        config.config_flask_filters(app)
        new = len(app.jinja_env.filters)
        self.assertGreater(new, old)

{'fraction_non_alphanumeric': 0.11531007751937984, 'fraction_numerical': 0.00032299741602067185, 'mean_word_length': 3.501453488372093, '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': '2733746', 'n_tokens_mistral': 933, 'n_tokens_neox': 903, 'n_words': 215}