def test_ParseServices_FunctionWithAmbiguousArgumentIds_RaisesRuntimeError():
    text = """
            service Foo
            {
                void Bar(1:i16 foo, 1:i32 bar);
            }
            """

    definition = RpcDefinition(text)
    tree = definition.parse()

    visitor = ServiceVisitor()

    with pytest.raises(RuntimeError):
        visitor.visit(tree)
def test_ParseServices_FunctionWithAmbiguousExceptionIds_RaisesRuntimeError():
    text = """
            exception ArgumentError { 1:i32 description; }
            exception ConfigurationError { 1:i32 description; }

            service Foo
            {
                void Bar() throws (1:ArgumentError error, 1:ConfigurationError error);
            }
            """

    definition = RpcDefinition(text)
    tree = definition.parse()

    visitor = ServiceVisitor()

    with pytest.raises(RuntimeError):
        visitor.visit(tree)