<commit_before>from django.test import SimpleTestCase
from pillowtop.utils import get_pillow_config_from_setting


class PillowConfigTest(SimpleTestCase):

    def test_from_string(self):
        class_name = 'my.cool.Pillow'
        config = get_pillow_config_from_setting('my-section', class_name)
        self.assertEqual('my-section', config.section)
        self.assertEqual(class_name, config.class_name)
        self.assertEqual(class_name, config.instance_generator)
<commit_msg>test for dict settings format<commit_after>from django.test import SimpleTestCase
from pillowtop.utils import get_pillow_config_from_setting


class PillowConfigTest(SimpleTestCase):

    def test_from_string(self):
        class_name = 'my.cool.Pillow'
        config = get_pillow_config_from_setting('my-section', class_name)
        self.assertEqual('my-section', config.section)
        self.assertEqual(class_name, config.class_name)
        self.assertEqual(class_name, config.instance_generator)

    def test_from_dict(self):
        pillow_config = {
            'class': 'my.cool.Pillow',
            'instance': 'my.instance.method',
            'name': 'MyPillow',
        }
        config = get_pillow_config_from_setting('my-section', pillow_config)
        self.assertEqual('my-section', config.section)
        self.assertEqual(pillow_config['class'], config.class_name)
        self.assertEqual(pillow_config['instance'], config.instance_generator)
        self.assertEqual(pillow_config['name'], config.name)

{'fraction_non_alphanumeric': 0.10039630118890357, 'fraction_numerical': 0.0, 'mean_word_length': 3.918831168831169, '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': '3603458', 'n_tokens_mistral': 451, 'n_tokens_neox': 442, 'n_words': 70}