diff options
Diffstat (limited to 'tests/inputs/casing')
-rw-r--r-- | tests/inputs/casing/casing.json | 4 | ||||
-rw-r--r-- | tests/inputs/casing/casing.proto | 20 | ||||
-rw-r--r-- | tests/inputs/casing/test_casing.py | 23 |
3 files changed, 47 insertions, 0 deletions
diff --git a/tests/inputs/casing/casing.json b/tests/inputs/casing/casing.json new file mode 100644 index 0000000..559104b --- /dev/null +++ b/tests/inputs/casing/casing.json @@ -0,0 +1,4 @@ +{ + "camelCase": 1, + "snakeCase": "ONE" +} diff --git a/tests/inputs/casing/casing.proto b/tests/inputs/casing/casing.proto new file mode 100644 index 0000000..2023d93 --- /dev/null +++ b/tests/inputs/casing/casing.proto @@ -0,0 +1,20 @@ +syntax = "proto3"; + +package casing; + +enum my_enum { + ZERO = 0; + ONE = 1; + TWO = 2; +} + +message Test { + int32 camelCase = 1; + my_enum snake_case = 2; + snake_case_message snake_case_message = 3; + int32 UPPERCASE = 4; +} + +message snake_case_message { + +}
\ No newline at end of file diff --git a/tests/inputs/casing/test_casing.py b/tests/inputs/casing/test_casing.py new file mode 100644 index 0000000..0fa609b --- /dev/null +++ b/tests/inputs/casing/test_casing.py @@ -0,0 +1,23 @@ +import tests.output_aristaproto.casing as casing +from tests.output_aristaproto.casing import Test + + +def test_message_attributes(): + message = Test() + assert hasattr( + message, "snake_case_message" + ), "snake_case field name is same in python" + assert hasattr(message, "camel_case"), "CamelCase field is snake_case in python" + assert hasattr(message, "uppercase"), "UPPERCASE field is lowercase in python" + + +def test_message_casing(): + assert hasattr( + casing, "SnakeCaseMessage" + ), "snake_case Message name is converted to CamelCase in python" + + +def test_enum_casing(): + assert hasattr( + casing, "MyEnum" + ), "snake_case Enum name is converted to CamelCase in python" |