Skip to content

Commit

Permalink
feat: not uppercasing readonly fields
Browse files Browse the repository at this point in the history
  • Loading branch information
jhonabreul committed Apr 10, 2024
1 parent ac0102b commit 71f1d35
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/embed_tests/ClassManagerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,10 @@ public void BindsSnakeCaseClassMethods(string originalMethodName, string snakeCa

[TestCase("PublicStringField", "public_string_field")]
[TestCase("PublicStaticStringField", "public_static_string_field")]
[TestCase("PublicReadonlyStringField", "public_readonly_string_field")]
[TestCase("PublicStaticReadonlyStringField", "public_static_readonly_string_field")]
// Constants
[TestCase("PublicConstStringField", "PUBLIC_CONST_STRING_FIELD")]
[TestCase("PublicReadonlyStringField", "PUBLIC_READONLY_STRING_FIELD")]
[TestCase("PublicStaticReadonlyStringField", "PUBLIC_STATIC_READONLY_STRING_FIELD")]
public void BindsSnakeCaseClassFields(string originalFieldName, string snakeCaseFieldName)
{
using var obj = new SnakeCaseNamesTesClass().ToPython();
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/ClassManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ private static ClassInfo GetClassInfo(Type type, ClassBase impl)
ci.members[mi.Name] = ob.AllocObject();

var pepName = fi.Name.ToSnakeCase();
if (fi.IsLiteral || fi.IsInitOnly)
if (fi.IsLiteral)
{
pepName = pepName.ToUpper();
}
Expand Down

0 comments on commit 71f1d35

Please sign in to comment.