Beispiel #1
0
            tofile="Generated",
        )
    ]

    diff = "\n".join(lines)
    if generated != expected:
        print(diff)
        assert False, f"Mismatch between {expected_file} and generated code"


@mark.parametrize(
    "classname, params, args, kwargs, expected",
    [
        param("Empty", {}, [], {}, Empty(), id="Empty"),
        param("UntypedArg", {"param": 11}, [], {},
              UntypedArg(param=11),
              id="UntypedArg"),
        param(
            "UntypedArg",
            {},
            [],
            {"param": LibraryClass()},
            UntypedArg(param=LibraryClass()),
            id="UntypedArg_passthrough_lib_class",
        ),
        param("IntArg", {"param": 1}, [], {}, IntArg(param=1), id="IntArg"),
        param("UnionArg", {"param": 1}, [], {},
              UnionArg(param=1),
              id="UnionArg"),
        param("UnionArg", {"param": 3.14}, [], {},
              UnionArg(param=3.14),
Beispiel #2
0
            tofile="Generated",
        )
    ]

    diff = "\n".join(lines)
    if generated != expected:
        print(diff)
        assert False, f"Mismatch between {expected_file} and generated code"


@mark.parametrize(
    "classname, params, args, kwargs, expected",
    [
        param("Empty", {}, [], {}, Empty(), id="Empty"),
        param(
            "UntypedArg", {"param": 11}, [], {}, UntypedArg(param=11), id="UntypedArg"
        ),
        param(
            "UntypedArg",
            {},
            [],
            {"param": LibraryClass()},
            UntypedArg(param=LibraryClass()),
            id="UntypedArg_passthrough_lib_class",
        ),
        param("IntArg", {"param": 1}, [], {}, IntArg(param=1), id="IntArg"),
        param("UnionArg", {"param": 1}, [], {}, UnionArg(param=1), id="UnionArg"),
        param("UnionArg", {"param": 3.14}, [], {}, UnionArg(param=3.14), id="UnionArg"),
        # This is okay because Union is not supported and is treated as Any
        param(
            "UnionArg",