Skip to content

Commit

Permalink
added function annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
Vivitsa Shankar authored and Vivitsa Shankar committed Jan 4, 2024
1 parent 4025852 commit 913c025
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions tests/plugin/text/test_dob_plugin/test_dob_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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},
Expand Down Expand Up @@ -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"]:
Expand Down

0 comments on commit 913c025

Please sign in to comment.