Enabling implicit output for generic bindings (#1348)

* Enabling implicit output for generic bindings

* Fixing comments

---------

Co-authored-by: gavin-aguiar <80794152+gavin-aguiar@users.noreply.github.com>
This commit is contained in:
Varad Meru 2023-11-14 15:34:53 -06:00 коммит произвёл GitHub
Родитель 56f5caf097
Коммит a981fcf788
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 8 добавлений и 8 удалений

Просмотреть файл

@ -52,4 +52,4 @@ class GenericBinding:
@classmethod
def has_implicit_output(cls) -> bool:
return False
return True

Просмотреть файл

@ -131,7 +131,7 @@ class TestGenericFunctions(testutils.AsyncTestCase):
protos.StatusResult.Success)
_, r = await host.invoke_function(
'foobar_as_bytes_no_anno', [
'foobar_implicit_output', [
protos.ParameterBinding(
name='input',
data=protos.TypedData(
@ -140,10 +140,10 @@ class TestGenericFunctions(testutils.AsyncTestCase):
)
]
)
# It should fail here, since generic binding requires
# $return statement in function.json to pass output
# It passes now as we are enabling generic binding to return output
# implicitly
self.assertEqual(r.response.result.status,
protos.StatusResult.Failure)
protos.StatusResult.Success)
async def test_mock_generic_should_support_without_datatype(self):
async with testutils.start_mockhost(
@ -166,7 +166,7 @@ class TestGenericFunctions(testutils.AsyncTestCase):
)
]
)
# It should fail here, since the generic binding requires datatype
# to be defined in function.json
# It passes now as we are enabling generic binding to return output
# implicitly
self.assertEqual(r.response.result.status,
protos.StatusResult.Failure)
protos.StatusResult.Success)