Skip to content

Commit 383f0b2

Browse files
committed
Added type hints
1 parent 8f04a3b commit 383f0b2

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

tests/unit/utils/test_types.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,30 +8,30 @@
88
class TestGraniteToolParser:
99
"""Unit tests for functions defined in utils/types.py."""
1010

11-
def test_get_tool_parser_when_model_is_is_not_granite(self):
11+
def test_get_tool_parser_when_model_is_is_not_granite(self) -> None:
1212
"""Test that the tool_parser is None when model_id is not a granite model."""
1313
assert (
1414
GraniteToolParser.get_parser("ollama3.3") is None
1515
), "tool_parser should be None"
1616

17-
def test_get_tool_parser_when_model_id_does_not_start_with_granite(self):
17+
def test_get_tool_parser_when_model_id_does_not_start_with_granite(self) -> None:
1818
"""Test that the tool_parser is None when model_id does not start with granite."""
1919
assert (
2020
GraniteToolParser.get_parser("a-fine-trained-granite-model") is None
2121
), "tool_parser should be None"
2222

23-
def test_get_tool_parser_when_model_id_starts_with_granite(self):
23+
def test_get_tool_parser_when_model_id_starts_with_granite(self) -> None:
2424
"""Test that the tool_parser is not None when model_id starts with granite."""
2525
tool_parser = GraniteToolParser.get_parser("granite-3.3-8b-instruct")
2626
assert tool_parser is not None, "tool_parser should not be None"
2727

28-
def test_get_tool_calls_from_completion_message_when_none(self):
28+
def test_get_tool_calls_from_completion_message_when_none(self) -> None:
2929
"""Test that get_tool_calls returns an empty array when CompletionMessage is None."""
3030
tool_parser = GraniteToolParser.get_parser("granite-3.3-8b-instruct")
3131
assert tool_parser is not None, "tool parser was not returned"
3232
assert tool_parser.get_tool_calls(None) == [], "get_tool_calls should return []"
3333

34-
def test_get_tool_calls_from_completion_message_when_not_none(self):
34+
def test_get_tool_calls_from_completion_message_when_not_none(self) -> None:
3535
"""Test that get_tool_calls returns an empty array when CompletionMessage has no tool_calls.""" # pylint: disable=line-too-long
3636
tool_parser = GraniteToolParser.get_parser("granite-3.3-8b-instruct")
3737
assert tool_parser is not None, "tool parser was not returned"
@@ -41,7 +41,9 @@ def test_get_tool_calls_from_completion_message_when_not_none(self):
4141
completion_message
4242
), "get_tool_calls should return []"
4343

44-
def test_get_tool_calls_from_completion_message_when_message_has_tool_calls(self):
44+
def test_get_tool_calls_from_completion_message_when_message_has_tool_calls(
45+
self,
46+
) -> None:
4547
"""Test that get_tool_calls returns the tool_calls when CompletionMessage has tool_calls."""
4648
tool_parser = GraniteToolParser.get_parser("granite-3.3-8b-instruct")
4749
assert tool_parser is not None, "tool parser was not returned"

0 commit comments

Comments
 (0)