예제 #1
0
def test_new_with_none():
    from kwiver.sprokit.pipeline import datum
    from kwiver.vital import types as kvt

    expect_exception(
        "attempting to store None as a string vector",
        TypeError,
        datum.new_string_vector,
        None,
    )

    expect_exception(
        "attempting to store None as a track_set",
        TypeError,
        datum.new_track_set,
        None,
    )

    expect_exception(
        "attempting to store None as a timestamp",
        TypeError,
        datum.new_timestamp,
        None,
    )

    # Should also fail for the automatic type conversion
    expect_exception(
        "attempting to store none through automatic conversion",
        TypeError,
        datum.new,
        None,
    )
예제 #2
0
def run_pipeline(sched_type, pipe, conf):
    from kwiver.vital.config import config
    from kwiver.vital.modules import modules
    from kwiver.sprokit.pipeline import scheduler_factory
    import sys

    modules.load_known_modules()

    if sched_type in cpp_scheds:
        expect_exception("trying to run a python process on a C++ scheduler", RuntimeError,
                         scheduler_factory.create_scheduler, sched_type, pipe, conf)

    else:
        s = scheduler_factory.create_scheduler(sched_type, pipe, conf)

        s.start()
        s.wait()
예제 #3
0
def test_add_none():
    from kwiver.sprokit.adapters import adapter_data_set
    from kwiver.vital import types as kvt

    ads = adapter_data_set.AdapterDataSet.create()

    expect_exception(
        "attempting to store None as a string vector",
        TypeError,
        ads._add_string_vector,
        "none_vector_string_port",
        None,
    )

    expect_exception(
        "attempting to store None as a track set",
        TypeError,
        ads._add_track_set,
        "none_track_set_port",
        None,
    )

    expect_exception(
        "attempting to store None as a timestamp",
        TypeError,
        ads._add_timestamp,
        "none_timestamp_port",
        None,
    )

    # Should also fail for the automatic type conversion
    expect_exception(
        "attempting to store none through automatic conversion",
        TypeError,
        ads.add_value,
        "none_port",
        None,
    )
예제 #4
0
파일: test-test.py 프로젝트: tao558/kwiver
def test_unexpected_exception():
    expect_exception('when throwing an unexpected exception', SyntaxError,
                     raise_exception)
예제 #5
0
파일: test-test.py 프로젝트: tao558/kwiver
def test_expected_exception():
    expect_exception('when throwing an exception', NotImplementedError,
                     raise_exception)
예제 #6
0
    def check_process(p):
        if p is None:
            test_error("Got a 'None' process")
            return

        p.properties()

        p.input_ports()
        p.output_ports()
        expect_exception("asking for info on a non-existant input port",
                         RuntimeError, p.input_port_info, iport)
        expect_exception("asking for info on a non-existant output port",
                         RuntimeError, p.output_port_info, oport)

        e = edge.Edge()

        expect_exception("connecting to a non-existant input port",
                         RuntimeError, p.connect_input_port, iport, e)
        expect_exception("connecting to a non-existant output port",
                         RuntimeError, p.connect_output_port, oport, e)

        p.available_config()
        p.available_tunable_config()
        expect_exception("asking for info on a non-existant config key",
                         RuntimeError, p.config_info, key)

        expect_exception("setting a type on a non-existent input port",
                         RuntimeError, p.set_input_port_type, iport, ptype)
        expect_exception("setting a type on a non-existent output port",
                         RuntimeError, p.set_output_port_type, oport, ptype)

        p.reset()

        p.configure()
        p.init()
        # TODO: Can't check this because the core frequency of the process
        # cannot be set. Needs to be stepped within a pipeline to verify this.
        # Enable the ran_step check in p.check when this is fixed.
        #p.step()

        # TODO: Can't check this because only the process_cluster base class
        # and the pipeline may reconfigure a process. Needs to be stepped
        # within a pipeline to verify this. Enable the ran_step check in
        # p.check when this is fixed.
        #p.reconfigure(reconf)

        del p