<commit_before># -*- coding:utf-8 -*-

import os

try:
    import unittest2 as unittest
except ImportError:
    import unittest  # NOQA

from sigal.settings import read_settings


class TestSettings(unittest.TestCase):
    "Read a settings file and check that the configuration is well done."

    def setUp(self):
        "Read the sample config file"
        self.path = os.path.abspath(os.path.dirname(__file__))
        default_conf = os.path.join(self.path, 'sample', 'sigal.conf.py')
        self.settings = read_settings(default_conf)

    def test_sizes(self):
        "Test that image sizes are correctly read"
        self.assertTupleEqual(self.settings['img_size'], (640, 480))
        self.assertTupleEqual(self.settings['thumb_size'], (200, 150))

    def test_settings(self):
        self.assertEqual(self.settings['thumb_suffix'], '.tn')
<commit_msg>Add a test for the get_thumb function.<commit_after># -*- coding:utf-8 -*-

import os

try:
    import unittest2 as unittest
except ImportError:
    import unittest  # NOQA

from sigal.settings import read_settings, get_thumb


class TestSettings(unittest.TestCase):
    "Read a settings file and check that the configuration is well done."

    def setUp(self):
        "Read the sample config file"
        self.path = os.path.abspath(os.path.dirname(__file__))
        default_conf = os.path.join(self.path, 'sample', 'sigal.conf.py')
        self.settings = read_settings(default_conf)

    def test_sizes(self):
        "Test that image sizes are correctly read"
        self.assertTupleEqual(self.settings['img_size'], (640, 480))
        self.assertTupleEqual(self.settings['thumb_size'], (200, 150))

    def test_settings(self):
        self.assertEqual(self.settings['thumb_suffix'], '.tn')

    def test_thumb(self):
        self.assertEqual(get_thumb(self.settings, 'example.jpg'),
                         'thumbnails/example.tn.jpg')
        self.assertEqual(get_thumb(self.settings, 'test/example.jpg'),
                         'test/thumbnails/example.tn.jpg')

{'fraction_non_alphanumeric': 0.11698482623592756, 'fraction_numerical': 0.013705335291238374, 'mean_word_length': 3.154471544715447, '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': '7354825', 'n_tokens_mistral': 637, 'n_tokens_neox': 601, 'n_words': 147}