Cloud Defense Logo

Products

Solutions

Company

Book A Live Demo

Top 10 Examples of "zeep in functional component" in Python

Dive into secure and efficient coding practices with our curated list of the top 10 examples showcasing 'zeep' in functional components in Python. Our advanced machine learning engine meticulously scans each line of code, cross-referencing millions of open source libraries to ensure your implementation is not just functional, but also robust and secure. Elevate your React applications to new heights by mastering the art of handling side effects, API calls, and asynchronous operations with confidence and precision.

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'}
def test_choice_sequences_no_match():
    xsd_type = xsd.ComplexType(
        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([])
    with pytest.raises(TypeError):
        kwargs = {'item_1': 'value-1', 'item_3': 'value-3'}
        valueobjects._process_signature(xsd_type, args, kwargs)
def test_create_node():
    custom_type = xsd.Element(
        etree.QName("http://tests.python-zeep.org/", "authentication"),
        xsd.ComplexType(
            xsd.Sequence(
                [
                    xsd.Element(
                        etree.QName("http://tests.python-zeep.org/", "username"),
                        xsd.String(),
                    ),
                    xsd.Element(
                        etree.QName("http://tests.python-zeep.org/", "password"),
                        xsd.String(),
                    ),
                ]
            ),
            [xsd.Attribute("attr", xsd.String())],
        ),
    )

    # sequences
    obj = custom_type(username="foo", password="bar", attr="x")
def test_build_occurs_1():
    custom_type = xsd.Element(
        etree.QName("http://tests.python-zeep.org/", "authentication"),
        xsd.ComplexType(
            xsd.All(
                [
                    xsd.Element(
                        etree.QName("http://tests.python-zeep.org/", "item_1"),
                        xsd.String(),
                    ),
                    xsd.Element(
                        etree.QName("http://tests.python-zeep.org/", "item_2"),
                        xsd.String(),
                    ),
                ]
            )
        ),
    )
def test_pickle():
    xsd_type = xsd.ComplexType(
        xsd.Sequence(
            [xsd.Element("item_1", xsd.String()), xsd.Element("item_2", xsd.String())]
        )
    )

    obj = xsd_type(item_1="x", item_2="y")

    data = pickle.dumps(obj)
    obj_rt = pickle.loads(data)

    assert obj.item_1 == "x"
    assert obj.item_2 == "y"
    assert obj_rt.item_1 == "x"
    assert obj_rt.item_2 == "y"
etree.QName("http://tests.python-zeep.org/", "authentication"),
        xsd.ComplexType(
            xsd.Sequence(
                [
                    xsd.Element(
                        etree.QName("http://tests.python-zeep.org/", "item_1"),
                        xsd.String(),
                    ),
                    xsd.Element(
                        etree.QName("http://tests.python-zeep.org/", "item_2"),
                        xsd.ComplexType(
                            xsd.Sequence(
                                [
                                    xsd.Choice(
                                        [
                                            xsd.Element(
                                                "{http://tests.python-zeep.org/}item_2a1",
                                                xsd.String(),
                                                min_occurs=0,
                                            ),
                                            xsd.Element(
                                                "{http://tests.python-zeep.org/}item_2a2",
                                                xsd.String(),
                                                min_occurs=0,
                                            ),
                                        ]
                                    ),
                                    xsd.Element(
                                        "{http://tests.python-zeep.org/}item_2b",
                                        xsd.String(),
                                    ),
                                ]
def test_choice_sequences_no_match_last():
    xsd_type = xsd.ComplexType(
        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([])
    with pytest.raises(TypeError):
        kwargs = {"item_2": "value-2", "item_4": "value-4"}
        valueobjects._process_signature(xsd_type, args, kwargs)
),
                        ]
                    ),
                    xsd.Choice(
                        [
                            xsd.Element(
                                etree.QName("http://tests.python-zeep.org/", "item_5"),
                                xsd.String(),
                            ),
                            xsd.Element(
                                etree.QName("http://tests.python-zeep.org/", "item_6"),
                                xsd.String(),
                            ),
                            xsd.Sequence(
                                [
                                    xsd.Element(
                                        etree.QName(
                                            "http://tests.python-zeep.org/", "item_7"
                                        ),
                                        xsd.String(),
                                    ),
                                    xsd.Element(
                                        etree.QName(
                                            "http://tests.python-zeep.org/", "item_8"
                                        ),
                                        xsd.String(),
                                    ),
                                ]
                            ),
                        ]
                    ),
                ]
def test_nested_attribute():
    schema = xsd.Schema(
        load_xml(
            """
        
        
          <element name="container">
            
              
                <element name="item">
                    
                        
                            <element name="x">
                        </element></element></element>
def test_xml_group_methods():
    schema = xsd.Schema(
        load_xml(
            """
        
        

          
            
              blub
            
            
              
              

Is your System Free of Underlying Vulnerabilities?
Find Out Now