<commit_before>#!@PYTHON_EXECUTABLE@
#ckwg +5
# Copyright 2011 by Kitware, Inc. All Rights Reserved. Please refer to
# KITWARE_LICENSE.TXT for licensing information, or contact General Counsel,
# Kitware, Inc., 28 Corporate Drive, Clifton Park, NY 12065.


def test_import():
    try:
        import vistk.pipeline_util.export_
    except:
        test_error("Failed to import the export_ module")


def test_simple_pipeline(path):
    import os

    from vistk.pipeline import pipeline
    from vistk.pipeline import modules
    from vistk.pipeline_util import bake
    from vistk.pipeline_util import export_

    modules.load_known_modules()

    p = bake.bake_pipe_file(path)
    r, w = os.pipe()

    name = 'graph'

    export_.export_dot(w, p, name)

    os.close(r)
    os.close(w)


def main(testname, path):
    if testname == 'import':
        test_import()
    elif testname == 'simple_pipeline':
        test_simple_pipeline(path)
    else:
        test_error("No such test '%s'" % testname)


if __name__ == '__main__':
    import os
    import sys

    if not len(sys.argv) == 5:
        test_error("Expected four arguments")
        sys.exit(1)

    testname = sys.argv[1]

    os.chdir(sys.argv[2])

    sys.path.append(sys.argv[3])

    pipeline_dir = sys.argv[4]

    path = os.path.join(pipeline_dir, '%s.pipe' % testname)

    from vistk.test.test import *

    try:
        main(testname, path)
    except BaseException as e:
        test_error("Unexpected exception: %s" % str(e))
<commit_msg>Test export_dot_setup in Python bindings<commit_after>#!@PYTHON_EXECUTABLE@
#ckwg +5
# Copyright 2011 by Kitware, Inc. All Rights Reserved. Please refer to
# KITWARE_LICENSE.TXT for licensing information, or contact General Counsel,
# Kitware, Inc., 28 Corporate Drive, Clifton Park, NY 12065.


def test_import():
    try:
        import vistk.pipeline_util.export_
    except:
        test_error("Failed to import the export_ module")


def test_simple_pipeline(path):
    import os

    from vistk.pipeline import pipeline
    from vistk.pipeline import modules
    from vistk.pipeline_util import bake
    from vistk.pipeline_util import export_

    modules.load_known_modules()

    p = bake.bake_pipe_file(path)
    r, w = os.pipe()

    name = 'graph'

    export_.export_dot(w, p, name)

    pipe.setup_pipeline()

    export_.export_dot_setup(w, p, name)

    os.close(r)
    os.close(w)


def main(testname, path):
    if testname == 'import':
        test_import()
    elif testname == 'simple_pipeline':
        test_simple_pipeline(path)
    else:
        test_error("No such test '%s'" % testname)


if __name__ == '__main__':
    import os
    import sys

    if not len(sys.argv) == 5:
        test_error("Expected four arguments")
        sys.exit(1)

    testname = sys.argv[1]

    os.chdir(sys.argv[2])

    sys.path.append(sys.argv[3])

    pipeline_dir = sys.argv[4]

    path = os.path.join(pipeline_dir, '%s.pipe' % testname)

    from vistk.test.test import *

    try:
        main(testname, path)
    except BaseException as e:
        test_error("Unexpected exception: %s" % str(e))

{'fraction_non_alphanumeric': 0.10613810741687979, 'fraction_numerical': 0.011508951406649617, 'mean_word_length': 2.9457755359394704, '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': '6608712', 'n_tokens_mistral': 1098, 'n_tokens_neox': 1045, 'n_words': 272}