Implement imports, simplified default value handling
This commit is contained in:
5
betterproto/tests/ref.json
Normal file
5
betterproto/tests/ref.json
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"greeting": {
|
||||
"greeting": "hello"
|
||||
}
|
||||
}
|
||||
9
betterproto/tests/ref.proto
Normal file
9
betterproto/tests/ref.proto
Normal file
@@ -0,0 +1,9 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package ref;
|
||||
|
||||
import "repeatedmessage.proto";
|
||||
|
||||
message Test {
|
||||
repeatedmessage.Sub greeting = 1;
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package repeatedmessage;
|
||||
|
||||
message Test {
|
||||
repeated Sub greetings = 1;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ import importlib
|
||||
import pytest
|
||||
import json
|
||||
|
||||
from generate import get_files, get_base
|
||||
from .generate import get_files, get_base
|
||||
|
||||
inputs = get_files(".bin")
|
||||
|
||||
@@ -10,7 +10,7 @@ inputs = get_files(".bin")
|
||||
@pytest.mark.parametrize("filename", inputs)
|
||||
def test_sample(filename: str) -> None:
|
||||
module = get_base(filename).split("-")[0]
|
||||
imported = importlib.import_module(module)
|
||||
imported = importlib.import_module(f"betterproto.tests.{module}")
|
||||
data_binary = open(filename, "rb").read()
|
||||
data_dict = json.loads(open(filename.replace(".bin", ".json")).read())
|
||||
t1 = imported.Test().parse(data_binary)
|
||||
|
||||
Reference in New Issue
Block a user