<commit_before>""" Test configuration code. """
from __future__ import absolute_import

import os
import yaml

from wok.conf import Config, TEMPLATE

WOK_FILE = './wok.yaml'

class TestConfig(object):
    def setup(self):
        output = yaml.dump(TEMPLATE)
        with open(WOK_FILE, 'w') as fout:
            fout.write(output)

        self.co = Config(WOK_FILE)

    def teardown(self):
        os.remove(WOK_FILE)

    def test_get(self):
        assert self.co.paths.get('prefix') == '/tmp/wok/builds'

    def test_filename(self):
        wok2 = './wok2.yaml'
        self.co.filename = wok2
        self.co.write()
        assert os.path.exists(wok2)
        os.remove(wok2)

    def test_set(self):
        self.co.set('paths.prefix', '/dev/null')
        assert self.co.paths.get('prefix') == '/dev/null'

    def test_write(self):
        self.co.set('paths.install', 22)
        self.co.write()
        self.co.load()
        assert self.co.paths.get('install') == 22

<commit_msg>Naming.<commit_after>""" Test configuration code. """
from __future__ import absolute_import

import os
import yaml

from wok.conf import Config, TEMPLATE

WOK_FILE = './wok.yaml'

class TestConfig(object):
    def setup(self):
        output = yaml.dump(TEMPLATE)
        with open(WOK_FILE, 'w') as fout:
            fout.write(output)

        self.conf = Config(WOK_FILE)

    def teardown(self):
        os.remove(WOK_FILE)

    def test_filename(self):
        wok2 = './wok2.yaml'
        self.conf.filename = wok2
        self.conf.write()
        assert os.path.exists(wok2)
        os.remove(wok2)

    def test_get(self):
        assert self.conf.paths.get('prefix') == '/tmp/wok/builds'

    def test_set(self):
        self.conf.set('paths.prefix', '/dev/null')
        assert self.conf.paths.get('prefix') == '/dev/null'

    def test_write(self):
        self.conf.set('paths.install', 22)
        self.conf.write()
        self.conf.load()
        assert self.conf.paths.get('install') == 22


{'fraction_non_alphanumeric': 0.14321357285429143, 'fraction_numerical': 0.008982035928143712, 'mean_word_length': 2.3754208754208754, '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': '7175304', 'n_tokens_mistral': 706, 'n_tokens_neox': 678, 'n_words': 134}