summaryrefslogtreecommitdiffstats
path: root/tests/inputs/casing
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-07-29 09:40:12 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-07-29 09:40:12 +0000
commit14b40ec77a4bf8605789cc3aff0eb87625510a41 (patch)
tree4064d27144d6deaabfcd96df01bd996baa8b51a0 /tests/inputs/casing
parentInitial commit. (diff)
downloadpython-aristaproto-14b40ec77a4bf8605789cc3aff0eb87625510a41.tar.xz
python-aristaproto-14b40ec77a4bf8605789cc3aff0eb87625510a41.zip
Adding upstream version 1.2+20240521.upstream/1.2+20240521upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/inputs/casing')
-rw-r--r--tests/inputs/casing/casing.json4
-rw-r--r--tests/inputs/casing/casing.proto20
-rw-r--r--tests/inputs/casing/test_casing.py23
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"