summaryrefslogtreecommitdiffstats
path: root/tests/inputs/repeated
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/repeated
parentInitial commit. (diff)
downloadpython-aristaproto-upstream.tar.xz
python-aristaproto-upstream.zip
Adding upstream version 1.2+20240521.upstream/1.2+20240521upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--tests/inputs/repeated/repeated.json3
-rw-r--r--tests/inputs/repeated/repeated.proto7
-rw-r--r--tests/inputs/repeated_duration_timestamp/repeated_duration_timestamp.json4
-rw-r--r--tests/inputs/repeated_duration_timestamp/repeated_duration_timestamp.proto12
-rw-r--r--tests/inputs/repeated_duration_timestamp/test_repeated_duration_timestamp.py12
-rw-r--r--tests/inputs/repeatedmessage/repeatedmessage.json10
-rw-r--r--tests/inputs/repeatedmessage/repeatedmessage.proto11
-rw-r--r--tests/inputs/repeatedpacked/repeatedpacked.json5
-rw-r--r--tests/inputs/repeatedpacked/repeatedpacked.proto9
9 files changed, 73 insertions, 0 deletions
diff --git a/tests/inputs/repeated/repeated.json b/tests/inputs/repeated/repeated.json
new file mode 100644
index 0000000..b8a7c4e
--- /dev/null
+++ b/tests/inputs/repeated/repeated.json
@@ -0,0 +1,3 @@
+{
+ "names": ["one", "two", "three"]
+}
diff --git a/tests/inputs/repeated/repeated.proto b/tests/inputs/repeated/repeated.proto
new file mode 100644
index 0000000..4f3c788
--- /dev/null
+++ b/tests/inputs/repeated/repeated.proto
@@ -0,0 +1,7 @@
+syntax = "proto3";
+
+package repeated;
+
+message Test {
+ repeated string names = 1;
+}
diff --git a/tests/inputs/repeated_duration_timestamp/repeated_duration_timestamp.json b/tests/inputs/repeated_duration_timestamp/repeated_duration_timestamp.json
new file mode 100644
index 0000000..6ce7b34
--- /dev/null
+++ b/tests/inputs/repeated_duration_timestamp/repeated_duration_timestamp.json
@@ -0,0 +1,4 @@
+{
+ "times": ["1972-01-01T10:00:20.021Z", "1972-01-01T10:00:20.021Z"],
+ "durations": ["1.200s", "1.200s"]
+}
diff --git a/tests/inputs/repeated_duration_timestamp/repeated_duration_timestamp.proto b/tests/inputs/repeated_duration_timestamp/repeated_duration_timestamp.proto
new file mode 100644
index 0000000..38f1eaa
--- /dev/null
+++ b/tests/inputs/repeated_duration_timestamp/repeated_duration_timestamp.proto
@@ -0,0 +1,12 @@
+syntax = "proto3";
+
+package repeated_duration_timestamp;
+
+import "google/protobuf/duration.proto";
+import "google/protobuf/timestamp.proto";
+
+
+message Test {
+ repeated google.protobuf.Timestamp times = 1;
+ repeated google.protobuf.Duration durations = 2;
+}
diff --git a/tests/inputs/repeated_duration_timestamp/test_repeated_duration_timestamp.py b/tests/inputs/repeated_duration_timestamp/test_repeated_duration_timestamp.py
new file mode 100644
index 0000000..aafc951
--- /dev/null
+++ b/tests/inputs/repeated_duration_timestamp/test_repeated_duration_timestamp.py
@@ -0,0 +1,12 @@
+from datetime import (
+ datetime,
+ timedelta,
+)
+
+from tests.output_aristaproto.repeated_duration_timestamp import Test
+
+
+def test_roundtrip():
+ message = Test()
+ message.times = [datetime.now(), datetime.now()]
+ message.durations = [timedelta(), timedelta()]
diff --git a/tests/inputs/repeatedmessage/repeatedmessage.json b/tests/inputs/repeatedmessage/repeatedmessage.json
new file mode 100644
index 0000000..90ec596
--- /dev/null
+++ b/tests/inputs/repeatedmessage/repeatedmessage.json
@@ -0,0 +1,10 @@
+{
+ "greetings": [
+ {
+ "greeting": "hello"
+ },
+ {
+ "greeting": "hi"
+ }
+ ]
+}
diff --git a/tests/inputs/repeatedmessage/repeatedmessage.proto b/tests/inputs/repeatedmessage/repeatedmessage.proto
new file mode 100644
index 0000000..0ffacaf
--- /dev/null
+++ b/tests/inputs/repeatedmessage/repeatedmessage.proto
@@ -0,0 +1,11 @@
+syntax = "proto3";
+
+package repeatedmessage;
+
+message Test {
+ repeated Sub greetings = 1;
+}
+
+message Sub {
+ string greeting = 1;
+} \ No newline at end of file
diff --git a/tests/inputs/repeatedpacked/repeatedpacked.json b/tests/inputs/repeatedpacked/repeatedpacked.json
new file mode 100644
index 0000000..106fd90
--- /dev/null
+++ b/tests/inputs/repeatedpacked/repeatedpacked.json
@@ -0,0 +1,5 @@
+{
+ "counts": [1, 2, -1, -2],
+ "signed": ["1", "2", "-1", "-2"],
+ "fixed": [1.0, 2.7, 3.4]
+}
diff --git a/tests/inputs/repeatedpacked/repeatedpacked.proto b/tests/inputs/repeatedpacked/repeatedpacked.proto
new file mode 100644
index 0000000..a037d1b
--- /dev/null
+++ b/tests/inputs/repeatedpacked/repeatedpacked.proto
@@ -0,0 +1,9 @@
+syntax = "proto3";
+
+package repeatedpacked;
+
+message Test {
+ repeated int32 counts = 1;
+ repeated sint64 signed = 2;
+ repeated double fixed = 3;
+}