How to use the zeep.xsd.valueobjects._process_signature function in zeep

To help you get started, we’ve selected a few zeep examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mvantellingen / python-zeep / tests / test_xsd_valueobjects.py View on Github external
def test_simple_args_attributes_as_kwargs():
    xsd_type = xsd.ComplexType(
        xsd.Sequence([
            xsd.Element('item_1', xsd.String()),
            xsd.Element('item_2', xsd.String())
        ]),
        [
            xsd.Attribute('attr_1', xsd.String())
        ]
    )
    args = tuple(['value-1', 'value-2'])
    kwargs = {'attr_1': 'bla'}
    result = valueobjects._process_signature(xsd_type, args, kwargs)
    assert result == {
        'item_1': 'value-1',
        'item_2': 'value-2',
        'attr_1': 'bla',
    }
github mvantellingen / python-zeep / tests / test_xsd_valueobjects.py View on Github external
def test_choice_sequences_no_match_nested():
    xsd_type = xsd.ComplexType(
        xsd.Sequence([
            xsd.Choice([
                xsd.Sequence([
                    xsd.Element('item_1', xsd.String()),
                    xsd.Element('item_2', xsd.String())
                ]),
            ])
        ])
    )
    args = tuple([])
    kwargs = {'item_1': 'value-1'}
    value = valueobjects._process_signature(xsd_type, args, kwargs)
    assert value == {
        'item_1': 'value-1',
        'item_2': None,
    }
github mvantellingen / python-zeep / tests / test_xsd_valueobjects.py View on Github external
def test_simple_mixed():
    xsd_type = xsd.ComplexType(
        xsd.Sequence([
            xsd.Element('item_1', xsd.String()),
            xsd.Element('item_2', xsd.String())
        ]))
    args = tuple(['value-1'])
    kwargs = {'item_2': 'value-2'}
    result = valueobjects._process_signature(xsd_type, args, kwargs)
    assert result == {
        'item_1': 'value-1',
        'item_2': 'value-2',
    }
github mvantellingen / python-zeep / tests / test_xsd_valueobjects.py View on Github external
xsd.Choice([
                xsd.Sequence([
                    xsd.Element('item_1', xsd.String()),
                    xsd.Element('item_2', xsd.String())
                ]),
                xsd.Sequence([
                    xsd.Element('item_3', xsd.String()),
                    xsd.Element('item_4', xsd.String())
                ]),
            ])
        ])
    )
    args = tuple([])
    with pytest.raises(TypeError):
        kwargs = {'item_1': 'value-1', 'item_3': 'value-3'}
        valueobjects._process_signature(xsd_type, args, kwargs)
github mvantellingen / python-zeep / tests / test_xsd_valueobjects.py View on Github external
),
                        xsd.Sequence(
                            [
                                xsd.Element("item_3", xsd.String()),
                                xsd.Element("item_4", xsd.String()),
                            ]
                        ),
                    ]
                )
            ]
        )
    )
    args = tuple([])
    with pytest.raises(TypeError):
        kwargs = {"item_2": "value-2", "item_4": "value-4"}
        valueobjects._process_signature(xsd_type, args, kwargs)
github mvantellingen / python-zeep / tests / test_xsd_valueobjects.py View on Github external
xsd.Sequence([
            xsd.Choice([
                xsd.Sequence([
                    xsd.Element('item_1', xsd.String()),
                    xsd.Element('item_2', xsd.String())
                ]),
                xsd.Sequence([
                    xsd.Element('item_3', xsd.String()),
                    xsd.Element('item_4', xsd.String())
                ]),
            ])
        ])
    )
    args = tuple([])
    kwargs = {'item_1': 'value-1', 'item_2': 'value-2'}
    result = valueobjects._process_signature(xsd_type, args, kwargs)
    assert result == {
        'item_1': 'value-1',
        'item_2': 'value-2',
        'item_3': None,
        'item_4': None,
    }
github mvantellingen / python-zeep / tests / test_xsd_valueobjects.py View on Github external
def test_simple_args_attributes_as_kwargs():
    xsd_type = xsd.ComplexType(
        xsd.Sequence(
            [xsd.Element("item_1", xsd.String()), xsd.Element("item_2", xsd.String())]
        ),
        [xsd.Attribute("attr_1", xsd.String())],
    )
    args = tuple(["value-1", "value-2"])
    kwargs = {"attr_1": "bla"}
    result = valueobjects._process_signature(xsd_type, args, kwargs)
    assert result == {"item_1": "value-1", "item_2": "value-2", "attr_1": "bla"}
github mvantellingen / python-zeep / tests / test_xsd_valueobjects.py View on Github external
def test_simple_args():
    xsd_type = xsd.ComplexType(
        xsd.Sequence([
            xsd.Element('item_1', xsd.String()),
            xsd.Element('item_2', xsd.String())
        ]))
    args = tuple(['value-1', 'value-2'])
    kwargs = {}
    result = valueobjects._process_signature(xsd_type, args, kwargs)
    assert result == {
        'item_1': 'value-1',
        'item_2': 'value-2',
    }
github mvantellingen / python-zeep / tests / test_xsd_valueobjects.py View on Github external
def test_choice():
    xsd_type = xsd.ComplexType(
        xsd.Sequence([
            xsd.Choice([
                xsd.Element('item_1', xsd.String()),
                xsd.Element('item_2', xsd.String())
            ])
        ])
    )
    args = tuple([])
    kwargs = {'item_2': 'value-2'}
    result = valueobjects._process_signature(xsd_type, args, kwargs)
    assert result == {'item_1': None, 'item_2': 'value-2'}
github mvantellingen / python-zeep / tests / test_xsd_valueobjects.py View on Github external
xsd_type = xsd.ComplexType(
        xsd.Sequence(
            [
                xsd.Choice(
                    [
                        xsd.Element("item_1", xsd.String(), max_occurs=2),
                        xsd.Element("item_2", xsd.String()),
                    ],
                    max_occurs=2,
                )
            ]
        )
    )
    args = tuple([])
    kwargs = {"_value_1": [{"item_1": ["foo", "bar"]}, {"item_2": "bla"}]}
    result = valueobjects._process_signature(xsd_type, args, kwargs)
    assert result == {"_value_1": [{"item_1": ["foo", "bar"]}, {"item_2": "bla"}]}