diff --git a/AutoRest/Generators/Python/Python/TemplateModels/MethodTemplateModel.cs b/AutoRest/Generators/Python/Python/TemplateModels/MethodTemplateModel.cs index f1c93804a1..2c3a051d9c 100644 --- a/AutoRest/Generators/Python/Python/TemplateModels/MethodTemplateModel.cs +++ b/AutoRest/Generators/Python/Python/TemplateModels/MethodTemplateModel.cs @@ -575,17 +575,17 @@ public string GetDocumentationType(IType type) { result = string.Format(CultureInfo.InvariantCulture, "list of {0}", GetDocumentationType(listType.ElementType)); } - else if (type is EnumType) + else if (enumType != null) { - if (type == ReturnType.Body) + if (enumType == ReturnType.Body) { if (enumType.ModelAsString) result = "str"; else - result = string.Format(CultureInfo.InvariantCulture, ":class:`{0} <{1}.models.{0}>`", type.Name, modelNamespace); + result = string.Format(CultureInfo.InvariantCulture, ":class:`{0} <{1}.models.{0}>`", enumType.Name, modelNamespace); } else - result = string.Format(CultureInfo.InvariantCulture, "str or :class:`{0} <{1}.models.{0}>`", type.Name, modelNamespace); + result = string.Format(CultureInfo.InvariantCulture, "str or :class:`{0} <{1}.models.{0}>`", enumType.Name, modelNamespace); } else if (type is DictionaryType) {