<commit_before>import unittest
import os
from glob import glob

from nose_parameterized import parameterized
from ruamel.yaml import load

from pyacd.parser import parse_acd

ACDTEST_DIR = os.path.join(os.path.dirname(os.path.realpath(__file__)), \
                          '../tests/acd')

def get_tests():
    tests = []
    acd_list = glob(ACDTEST_DIR+'/*.acd')
    for acd_path in acd_list:
        tests.append([acd_path])
    return  tests


class TestParseAcd(unittest.TestCase):

    @parameterized.expand(get_tests())
    def parse_command_line(self, acd_path):
        try:
            acd_string = open(acd_path, 'r').read()
            acd_object = parse_acd(acd_string)
            print acd_object.application.name, acd_object.parameter_names(), \
                [section.name for section in acd_object.sections]
        except Exception as exc:
            print "Failure parsing ACD file {0}".format(acd_path)
            raise exc<commit_msg>test all sections have been parsed<commit_after>import unittest
import os
from glob import glob

from nose_parameterized import parameterized
from ruamel.yaml import load

from pyacd.parser import parse_acd

ACDTEST_DIR = os.path.join(os.path.dirname(os.path.realpath(__file__)), \
                          '../tests/acd')

def get_acds_list():
    tests = []
    acd_list = glob(ACDTEST_DIR+'/*.acd')
    for acd_path in acd_list:
        tests.append([acd_path])
    return  tests


class TestParseAcd(unittest.TestCase):

    @parameterized.expand(get_acds_list())
    def parse_command_line(self, acd_path):
        try:
            acd_string = open(acd_path, 'r').read()
            acd_object = parse_acd(acd_string)
            # sections count
            self.assertEqual(acd_string.count('endsection'),
                             len(acd_object.desc_sections()))
        except Exception as exc:
            print "Failure parsing ACD file {0}".format(acd_path)
            raise exc
{'fraction_non_alphanumeric': 0.0975485188968335, 'fraction_numerical': 0.0010214504596527069, 'mean_word_length': 2.6277777777777778, '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': '7427743', 'n_tokens_mistral': 620, 'n_tokens_neox': 614, 'n_words': 134}