<commit_before>#
# Copyright (C) 2021 <NAME> <<EMAIL>>
# License: MIT
#
# pylint: disable=missing-docstring
import unittest

import anyconfig.parsers

from tests.base import (
    DATA_00, list_resources
)


class BaseTestCase(unittest.TestCase):

    # see: tests/res/json/basic/
    kind = 'basic'

    @property
    def ies(self):
        return (
            (inp, DATA_00[inp])
            for inp in list_resources('json/{self.kind}/*.json')
        )

    @property
    def psr(self):
        return anyconfig.parsers.find(self.ies[0][0], 'json')
<commit_msg>fix: check if test data was found<commit_after>#
# Copyright (C) 2021 <NAME> <<EMAIL>>
# License: MIT
#
# pylint: disable=missing-docstring
import unittest

import anyconfig.parsers

from tests.base import (
    DATA_00, list_resources
)


class BaseTestCase(unittest.TestCase):

    # see: tests/res/json/basic/
    kind = 'basic'

    @property
    def ies(self):
        path = f'json/{self.kind}/*.json'
        _ies = [
            (inp, DATA_00.get(str(inp), None)) for inp in list_resources(path)
        ]
        if not _ies:
            raise RuntimeError(f'No data: {path}')

        return _ies

    @property
    def psr(self):
        return anyconfig.parsers.find(self.ies[0][0], 'json')

{'fraction_non_alphanumeric': 0.13159968479117415, 'fraction_numerical': 0.015760441292356184, 'mean_word_length': 2.681159420289855, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '7133463', 'n_tokens_mistral': 452, 'n_tokens_neox': 428, 'n_words': 100}