def test_objc_method_signature__multiple_params_linked_return(context): method = Member("objc") method.name = "setValue:withUnit:andALongerParam:" method.returns = ReturnValue() method.returns.type = TypeRef("objc", name="Value") method.returns.type.id = "objc-value" param1 = Parameter() param1.name = "arg1" param1.type = TypeRef("objc", "Type1") param2 = Parameter() param2.name = "arg2" param2.type = TypeRef("objc", "Type2") param2.type.id = "objc-type2" param3 = Parameter() param3.name = "arg3" param3.type = TypeRef("objc", "Type3") method.params = [param1, param2, param3] assert (objc_method_signature( method, context) == "- (xref:objc-value[Value])setValue:(Type1)arg1\n" " withUnit:(xref:objc-type2[Type2])arg2\n" " andALongerParam:(Type3)arg3")
def test_params__no_type(): param1 = Parameter() param1.type = None param1.name = "arg1" param2 = Parameter() param2.type = None param2.name = "arg2" member = Member("lang") member.params = [param1, param2] assert list(params(member)) == [param1, param2]
def test_objc_method_signature__one_param(context): method = Member("objc") method.name = "setValue:" method.returns = ReturnValue() method.returns.type = TypeRef("objc", name="Value") method.returns.type.id = "objc-value" param1 = Parameter() param1.name = "arg1" param1.type = TypeRef("objc", "Type1") method.params = [param1] assert objc_method_signature( method, context) == "- (xref:objc-value[Value])setValue:(Type1)arg1"
def test_params__cls(): type1 = TypeRef("lang") type1.name = "cls" type2 = TypeRef("lang") type2.name = "float" param1 = Parameter() param1.type = type1 param2 = Parameter() param2.type = type2 param2.name = "arg2" member = Member("lang") member.params = [param1, param2] assert list(params(member)) == [param2]