<commit_before>import os
import AutoNetkit
import AutoNetkit.config as config
from pkg_resources import resource_filename
import logging
LOG = logging.getLogger("ANK")
import difflib

def test_dumps():
    master_dir = (resource_filename(__name__, "comparisons"))
    inet = AutoNetkit.internet.Internet("multias", netkit=True) 
    inet.compile()
    inet.dump()

    f_test = os.path.join(config.log_dir, "bgp.txt")
    test_file = open(f_test, "Ur").read()
    master_file = open(os.path.join(master_dir, "bgp.txt"), "Ur").read()

    try:
        assert(test_file == master_file)
    except AssertionError:
        message = ''.join(difflib.ndiff(test_file.splitlines(True),
            master_file.splitlines(True)))
        LOG.warn(message)
        raise AssertionError

    f_test = os.path.join(config.log_dir, "physical.txt")
    test_file = open(f_test, "Ur").read()
    master_file = open(os.path.join(master_dir, "physical.txt"), "Ur").read()

    try:
        assert(test_file == master_file)
    except AssertionError:
        message = ''.join(difflib.ndiff(test_file.splitlines(True),
            master_file.splitlines(True)))
        LOG.warn(message)
        raise AssertionError

<commit_msg>don't compile netkit if not needed<commit_after>import os
import AutoNetkit
import AutoNetkit.config as config
from pkg_resources import resource_filename
import logging
LOG = logging.getLogger("ANK")
import difflib

def test_dumps():
    master_dir = (resource_filename(__name__, "comparisons"))
    inet = AutoNetkit.internet.Internet("multias") 
    inet.compile()
    inet.dump()

    f_test = os.path.join(config.log_dir, "bgp.txt")
    test_file = open(f_test, "Ur").read()
    master_file = open(os.path.join(master_dir, "bgp.txt"), "Ur").read()

    try:
        assert(test_file == master_file)
    except AssertionError:
        message = ''.join(difflib.ndiff(test_file.splitlines(True),
            master_file.splitlines(True)))
        LOG.warn(message)
        raise AssertionError

    f_test = os.path.join(config.log_dir, "physical.txt")
    test_file = open(f_test, "Ur").read()
    master_file = open(os.path.join(master_dir, "physical.txt"), "Ur").read()

    try:
        assert(test_file == master_file)
    except AssertionError:
        message = ''.join(difflib.ndiff(test_file.splitlines(True),
            master_file.splitlines(True)))
        LOG.warn(message)
        raise AssertionError


{'fraction_non_alphanumeric': 0.12941659819227608, 'fraction_numerical': 0.0, 'mean_word_length': 3.500924214417745, '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': '3914916', 'n_tokens_mistral': 826, 'n_tokens_neox': 793, 'n_words': 144}