<commit_before>from tornado.ioloop import IOLoop
import tornado.testing
from nvchecker.get_version import get_version


class ExternalVersionTestCase(tornado.testing.AsyncTestCase):
    def get_new_ioloop(self):
        return IOLoop.instance()

    def sync_get_version(self, name, config):
        def get_version_callback(name, version):
            self.stop(version)

        get_version(name, config, get_version_callback)
        return self.wait()<commit_msg>test helper: generate a real ConfigParser to make all its methods available<commit_after>import configparser
from tornado.ioloop import IOLoop
import tornado.testing
from nvchecker.get_version import get_version


class ExternalVersionTestCase(tornado.testing.AsyncTestCase):
    def get_new_ioloop(self):
        return IOLoop.instance()

    def sync_get_version(self, name, config):
        def get_version_callback(name, version):
            self.stop(version)

        if isinstance(config, dict):
            _config = configparser.ConfigParser(dict_type=dict, allow_no_value=True)
            _config.read_dict({name: config})
            _config = _config[name]
        else:
            _config = config

        get_version(name, _config, get_version_callback)
        return self.wait()
{'fraction_non_alphanumeric': 0.07509881422924901, 'fraction_numerical': 0.0, 'mean_word_length': 3.505338078291815, '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': '4373451', 'n_tokens_mistral': 365, 'n_tokens_neox': 347, 'n_words': 83}