Skip to content

Different casing.snake_case implementation in betterproto2_compiler and betterproto2 #156

@mgora-fugro

Description

@mgora-fugro

Summary

The different implementation of snake_case leads to inconsistent results

Reproduction Steps

import betterproto2
import betterproto2_compiler
print(betterproto2.casing.snake_case("M12"))
print(betterproto2_compiler.casing.snake_case("M12"))

This issue was found while using the from_dict() function.

Expected Results

m_12
m_12

or

m12
m12

I have no idea what is the correct transformation here, it should be consistent though

Actual Results

m12
m_12

System Information

betterproto2 0.9.0
betterproto2-compiler 0.9.0
didn't verify on prerelease but I can see that the code hasn't been touched for casing in 4 months

Checklist

  • I have searched the issues for duplicates.
  • I have shown the entire traceback, if possible.
  • I have verified this issue occurs on the latest prelease of betterproto which can be installed using pip install -U --pre betterproto, if possible.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions