Move betterproto/tests → tests
This commit is contained in:
committed by
Bouke Versteegh
parent
8864f4fdbd
commit
cebf9176a3
3
tests/inputs/oneof/oneof-name.json
Normal file
3
tests/inputs/oneof/oneof-name.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"name": "foobar"
|
||||
}
|
||||
3
tests/inputs/oneof/oneof.json
Normal file
3
tests/inputs/oneof/oneof.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"count": 100
|
||||
}
|
||||
8
tests/inputs/oneof/oneof.proto
Normal file
8
tests/inputs/oneof/oneof.proto
Normal file
@@ -0,0 +1,8 @@
|
||||
syntax = "proto3";
|
||||
|
||||
message Test {
|
||||
oneof foo {
|
||||
int32 count = 1;
|
||||
string name = 2;
|
||||
}
|
||||
}
|
||||
15
tests/inputs/oneof/test_oneof.py
Normal file
15
tests/inputs/oneof/test_oneof.py
Normal file
@@ -0,0 +1,15 @@
|
||||
import betterproto
|
||||
from tests.output_betterproto.oneof import Test
|
||||
from tests.util import get_test_case_json_data
|
||||
|
||||
|
||||
def test_which_count():
|
||||
message = Test()
|
||||
message.from_json(get_test_case_json_data("oneof"))
|
||||
assert betterproto.which_one_of(message, "foo") == ("count", 100)
|
||||
|
||||
|
||||
def test_which_name():
|
||||
message = Test()
|
||||
message.from_json(get_test_case_json_data("oneof", "oneof-name.json"))
|
||||
assert betterproto.which_one_of(message, "foo") == ("name", "foobar")
|
||||
Reference in New Issue
Block a user