forked from loafle/openapi-generator-original
[WIP][python-exp] Force camelization of imports (#7186)
* [python-exp] Force camelization of imports * Add unit test
This commit is contained in:
@@ -330,7 +330,7 @@ public class PythonClientExperimentalCodegen extends PythonClientCodegen {
|
||||
@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);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -333,4 +333,12 @@ public class PythonClientExperimentalTest {
|
||||
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");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user