<commit_before>from django.utils import unittest
from Instanssi.dbsettings.models import Setting

class SettingTestCase(unittest.TestCase):
    def setUp(self):
        Setting.set(u"lion", u"roar")
        Setting.set(u"cat_in_tree", True)
        Setting.set(u"cat_not_in_tree", False)
        Setting.set(u"count_cats", 123423)
        Setting.set(u"Gentoo", u"vroom!")
        Setting.set(u"Gentoo", u"vroom, vroom!")
        
    def test_fetch(self):
        self.assertEqual(Setting.get(u"lion"), u"roar", u"Detected problem with saving strings!")
        self.assertEqual(Setting.get(u"cat_in_tree"), True, u"Detected problem with saving booleans!")
        self.assertEqual(Setting.get(u"cat_not_in_tree"), False, u"Detected problem with saving booleans!")
        self.assertEqual(Setting.get(u"count_cats"), 123423, u"Detected problem with saving integers!")
        self.assertEqual(Setting.get(u"Gentoo"), u"vroom, vroom!", u"Detected problem with overwriting an existing settings key!")        
    <commit_msg>dbsettings: Test group fetch<commit_after>from django.utils import unittest
from Instanssi.dbsettings.models import Setting

class SettingTestCase(unittest.TestCase):
    def setUp(self):
        Setting.set(u"lion", u"roar")
        Setting.set(u"cat_in_tree", True)
        Setting.set(u"cat_not_in_tree", False)
        Setting.set(u"count_cats", 123423)
        Setting.set(u"Gentoo", u"vroom!")
        Setting.set(u"Gentoo", u"vroom, vroom!")
        Setting.set(u"GroupedItem1", u'String', u'AwesomeGroup')
        Setting.set(u"GroupedItem2", 234234, u'AwesomeGroup')
        self.testd = {
            'GroupedItem1': u"String",
            'GroupedItem2': 234234,
        }
        
    def test_fetch(self):
        self.assertEqual(Setting.get(u"lion"), u"roar", u"Detected problem with saving strings!")
        self.assertEqual(Setting.get(u"cat_in_tree"), True, u"Detected problem with saving booleans!")
        self.assertEqual(Setting.get(u"cat_not_in_tree"), False, u"Detected problem with saving booleans!")
        self.assertEqual(Setting.get(u"count_cats"), 123423, u"Detected problem with saving integers!")
        self.assertEqual(Setting.get(u"Gentoo"), u"vroom, vroom!", u"Detected problem with overwriting an existing settings key!")
        self.assertDictEqual(Setting.get_by_group(u'AwesomeGroup'), self.testd, u"Detected problem with getting settings by groupname!")

    
{'fraction_non_alphanumeric': 0.12880658436213993, 'fraction_numerical': 0.01646090534979424, 'mean_word_length': 3.8815261044176705, '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': '6411465', 'n_tokens_mistral': 831, 'n_tokens_neox': 779, 'n_words': 155}