diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-07-29 09:40:12 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-07-29 09:40:12 +0000 |
commit | 14b40ec77a4bf8605789cc3aff0eb87625510a41 (patch) | |
tree | 4064d27144d6deaabfcd96df01bd996baa8b51a0 /tests/inputs/bool | |
parent | Initial commit. (diff) | |
download | python-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 'tests/inputs/bool')
-rw-r--r-- | tests/inputs/bool/bool.json | 3 | ||||
-rw-r--r-- | tests/inputs/bool/bool.proto | 7 | ||||
-rw-r--r-- | tests/inputs/bool/test_bool.py | 19 |
3 files changed, 29 insertions, 0 deletions
diff --git a/tests/inputs/bool/bool.json b/tests/inputs/bool/bool.json new file mode 100644 index 0000000..348e031 --- /dev/null +++ b/tests/inputs/bool/bool.json @@ -0,0 +1,3 @@ +{ + "value": true +} diff --git a/tests/inputs/bool/bool.proto b/tests/inputs/bool/bool.proto new file mode 100644 index 0000000..77836b8 --- /dev/null +++ b/tests/inputs/bool/bool.proto @@ -0,0 +1,7 @@ +syntax = "proto3"; + +package bool; + +message Test { + bool value = 1; +} diff --git a/tests/inputs/bool/test_bool.py b/tests/inputs/bool/test_bool.py new file mode 100644 index 0000000..f9554ae --- /dev/null +++ b/tests/inputs/bool/test_bool.py @@ -0,0 +1,19 @@ +import pytest + +from tests.output_aristaproto.bool import Test +from tests.output_aristaproto_pydantic.bool import Test as TestPyd + + +def test_value(): + message = Test() + assert not message.value, "Boolean is False by default" + + +def test_pydantic_no_value(): + with pytest.raises(ValueError): + TestPyd() + + +def test_pydantic_value(): + message = Test(value=False) + assert not message.value |