@skipif((3,) < sys.version_info, reason='not Python 3.x')
def test_functiondef_some_more():
    code = """
    def foo(a, b=3, *, c=4, d):
        pass
    def bar(a:[], b:(1,2), *c:'xx', **d:'yy') -> 'returns':
        pass
    """
    code = '\n'.join(x[4:] for x in code.splitlines())
    
    root = commonast.parse(code)
    assert len(root.body_nodes) == 2
    
    f1, f2 = root.body_nodes
    assert isinstance(f1, commonast.FunctionDef)
    assert isinstance(f2, commonast.FunctionDef)
    
    # Test args of foo (focus on default values)
    assert len(f1.arg_nodes) == 2
    assert len(f1.kwarg_nodes) == 2
    for arg, name in zip(f1.arg_nodes + f1.kwarg_nodes, 'abcd'):
        assert isinstance(arg, commonast.Arg)
        assert arg.name == name
        assert arg.annotation_node is None
    assert f1.arg_nodes[0].value_node is None
    assert f1.arg_nodes[1].value_node.value == 3  # Num node
    assert f1.kwarg_nodes[0].value_node.value == 4
    assert f1.kwarg_nodes[1].value_node is None
    
    # Test args of bar (focus on annotations)
    assert len(f2.arg_nodes) == 2
    assert len(f2.kwarg_nodes) == 0
    for arg, name in zip(f2.arg_nodes + [f2.args_node, f2.kwargs_node], 'abcd'):
        assert isinstance(arg, commonast.Arg)
        assert arg.name == name
    assert f2.args_node.value_node is None
    assert f2.kwargs_node.value_node is None
    #
    assert isinstance(f2.arg_nodes[0].annotation_node, commonast.List)
    assert isinstance(f2.arg_nodes[1].annotation_node, commonast.Tuple)
    assert isinstance(f2.args_node.annotation_node, commonast.Str)
    assert isinstance(f2.kwargs_node.annotation_node, commonast.Str)
dataset/ETHPy150Open zoofIO/flexx/flexx/pyscript/tests/test_commonast.py/test_functiondef_some_more/swapped operands of `<`