<commit_before>#!/usr/bin/env python
"""
Unit test the ezlogger library.
"""
import os
import sys

# Append parent directory in order to access the configuration files from the parent dir.
CUR_DIR_PATH = os.path.dirname(os.path.realpath(__file__))
PARENT_DIR_PATH = os.path.abspath(os.path.join(CUR_DIR_PATH, os.pardir))

sys.path.append(os.path.join(PARENT_DIR_PATH, 'ezlogger'))

def test_import():
    # Assert you can import the library
    import ezlogger
    assert ezlogger

def test_argparse():
    # Assert internal argparse is working
    import ezlogger

    logger = initialize_logger(default_argparse(), 'name_of_logging_instance')

    assert logger

    # Assert bypass of internal argparse is working
    args = ezlogger.default_argparse(pre_parse=True)
    logger = initialize_logger(args, 'name_of_logging_instance')

    assert logger

def assert_syslog():
    # Assert gathering of syslog env vars is functional
    import ezlogger

    args = ezlogger.default_argparse(pre_parse=True)
    args.syslog = True # This will enable syslogging
    args.syslog_level = 'warning' # This is optional, can be info, warning or error and controls the syslog facility at which to write logs.
    logger = ezlogger.initialize_logger(args, 'name_of_logging_instance', syslog_server='10.20.30.40')<commit_msg>Minor update to test file, correcting imports.<commit_after>#!/usr/bin/env python
"""
Unit test the ezlogger library.
"""
import os
import sys

# Append parent directory in order to access the configuration files from the parent dir.
CUR_DIR_PATH = os.path.dirname(os.path.realpath(__file__))
PARENT_DIR_PATH = os.path.abspath(os.path.join(CUR_DIR_PATH, os.pardir))

sys.path.append(os.path.join(PARENT_DIR_PATH, 'ezlogger'))

def test_import():
    # Assert you can import the library
    import ezlogger
    assert ezlogger

def test_argparse():
    # Assert internal argparse is working
    from ezlogger import initialize_logger, \
                         default_argparse

    logger = initialize_logger(default_argparse(), 'name_of_logging_instance')

    assert logger

    # Assert bypass of internal argparse is working
    args = default_argparse(pre_parse=True)
    logger = initialize_logger(args, 'name_of_logging_instance')

    assert logger

def assert_syslog():
    # Assert gathering of syslog env vars is functional
    from ezlogger import default_argparse, \
                         initialize_logger

    args = default_argparse(pre_parse=True)
    args.syslog = True # This will enable syslogging
    args.syslog_level = 'warning' # This is optional, can be info, warning or error and controls the syslog facility at which to write logs.
    logger = initialize_logger(args, 'name_of_logging_instance', syslog_server='10.20.30.40')
{'fraction_non_alphanumeric': 0.08050541516245488, 'fraction_numerical': 0.005776173285198556, 'mean_word_length': 4.1031307550644565, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '6109829', 'n_tokens_mistral': 842, 'n_tokens_neox': 812, 'n_words': 245}