From 913c0259e51d30429d6d937bd0c36d97af54be48 Mon Sep 17 00:00:00 2001 From: Vivitsa Shankar Date: Thu, 4 Jan 2024 14:40:36 +0530 Subject: [PATCH] added function annotations --- tests/plugin/text/test_dob_plugin/test_dob_plugin.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/plugin/text/test_dob_plugin/test_dob_plugin.py b/tests/plugin/text/test_dob_plugin/test_dob_plugin.py index 6ada01ac..7e9c8667 100644 --- a/tests/plugin/text/test_dob_plugin/test_dob_plugin.py +++ b/tests/plugin/text/test_dob_plugin/test_dob_plugin.py @@ -2,6 +2,9 @@ import pandas as pd import pytest +from typing import Any, List, Optional, Union, Dict +from typing import Any, Callable, List +from dialogy.types import Utterance from dialogy.base import Input from dialogy.plugins.registry import DOBPlugin @@ -18,7 +21,7 @@ Description: for each transcript, check if duckling(transcript)==duckling(expected) Output: true/false, %increase in correctness """ -def checker(transcripts,expected): +def checker(transcripts: List[str], expected: str) -> Union[int, None]: """ input: transcripts- a list of strings; expected- a string description: for each transcript, check if get_entities_from_duckling(transcript)==get_entities_from_duckling(expected), if yes correctness +=1 @@ -38,7 +41,7 @@ def checker(transcripts,expected): pass return correctness -def get_transcripts_from_utterances(utterances): +def get_transcripts_from_utterances(utterances: List[Utterance]) -> List[str]: """ input: utterances = [ [{'transcript': '102998', 'confidence': None}, @@ -91,7 +94,7 @@ async def test_dob_1() -> None: @pytest.mark.asyncio -@pytest.mark.parametrize("test_case", load_tests("cases_desc", __file__)) +@pytest.mark.parametrize("test_case", load_tests("cases_desc", __file__)) async def test_dob_2(test_case) -> None: try: if test_case["description"]: