Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[python-exp] Force camelization of imports #7186

Merged
merged 2 commits into from
Aug 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ public String toDefaultValue(Schema p) {
@Override
public String toModelImport(String name) {
// name looks like Cat
return "from " + modelPackage() + "." + toModelFilename(name) + " import "+ name;
return "from " + modelPackage() + "." + toModelFilename(name) + " import "+ toModelName(name);
spacether marked this conversation as resolved.
Show resolved Hide resolved
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,4 +333,12 @@ public void parseDateAndDateTimeExamplesTest() {
Assert.assertEquals(defaultValue, "dateutil_parser('2010-01-01T10:10:10.000111+01:00')");
}

@Test(description = "format imports of models containing special characters")
public void importSpecialModelNameTest() {
final PythonClientExperimentalCodegen codegen = new PythonClientExperimentalCodegen();

String importValue = codegen.toModelImport("special.ModelName");
Assert.assertEquals(importValue, "from models.special_model_name import SpecialModelName");
}

}