Ejemplo n.º 1
0
def test_manager_path():
    rooted_manager = dm.define_manager(
        define_pandas_input_transform_test_solid())
    dirname = os.path.dirname(
        os.path.abspath(nb_test_path('pandas_input_transform_test')))
    assert rooted_manager.get_path('foo') == os.path.join(dirname, 'foo')

    unrooted_manager = dm.define_manager()
    assert unrooted_manager.get_path('foo') == 'foo'
Ejemplo n.º 2
0
def test_input_typecheck():
    manager = dm.define_manager(define_solid_with_stuff())
    manager.define_inputs(foo=2)

    with pytest.raises(dm.DagstermillError,
                       match='Input foo failed type check'):
        manager.define_inputs(foo='ndokfjdkf')
Ejemplo n.º 3
0
def test_input_names():
    manager = dm.define_manager(define_solid_with_stuff())
    manager.define_inputs(foo=2)

    with pytest.raises(dm.DagstermillError,
                       match='Solid stuff does not have input baaz'):
        manager.define_inputs(baaz=2)
Ejemplo n.º 4
0
def test_config_typecheck():
    manager = dm.define_manager(define_solid_with_stuff())
    manager.define_config(2)

    with pytest.raises(dm.DagstermillError,
                       match='Config for solid stuff failed type check'):
        manager.define_config('2k3j4k3')
Ejemplo n.º 5
0
def test_output_typemismatch():
    manager = dm.define_manager(define_solid_with_stuff())

    with pytest.raises(
            dm.DagstermillError,
            match='Solid stuff output bar output_type Int failed type check',
    ):
        manager.yield_result('not_a_string', output_name='bar')
Ejemplo n.º 6
0
def test_output_name():
    manager = dm.define_manager(define_solid_with_stuff())

    with pytest.raises(dm.DagstermillError,
                       match='Solid stuff does not have output named nope'):
        manager.yield_result(234, output_name='nope')

    with pytest.raises(dm.DagstermillError,
                       match='Solid stuff does not have output named result'):
        manager.yield_result(234)
Ejemplo n.º 7
0
def test_basic_get_serialized_inputs():
    manager = dm.define_manager()
    inputs = dm.serialize_dm_object(dict(a=1, b=2))
    assert manager.get_input(inputs, 'a') == 1
    assert manager.get_input(inputs, 'b') == 2

    a, b = manager.get_inputs(inputs, 'a', 'b')

    assert a == 1
    assert b == 2
Ejemplo n.º 8
0
def test_basic_get_in_memory_inputs():
    manager = dm.define_manager()
    inputs = manager.define_inputs(a=1, b=2)
    assert manager.get_input(inputs, 'a') == 1
    assert manager.get_input(inputs, 'b') == 2

    a, b = manager.get_inputs(inputs, 'a', 'b')

    assert a == 1
    assert b == 2
Ejemplo n.º 9
0
def test_basic_serialized_config():
    manager = dm.define_manager()
    value = {'path': 'some_path.csv'}
    config_ = dm.serialize_dm_object(value)
    assert manager.get_config(config_) == value
Ejemplo n.º 10
0
def test_basic_in_memory_config():
    manager = dm.define_manager()
    value = {'path': 'some_path.csv'}
    config_ = manager.define_config(value)
    assert manager.get_config(config_) == value
Ejemplo n.º 11
0
def test_basic_get_in_memory_input():
    manager = dm.define_manager()
    inputs = manager.define_inputs(a=1)
    assert manager.get_input(inputs, 'a') == 1