Skip to content

Commit 7efaef8

Browse files
committed
refactor: add type hints to node creation tests and ignore type comparison overlaps
1 parent f9d6cff commit 7efaef8

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

src/aact/nodes/base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ def __init__(
182182
f"Input channel type {input_channel_type} is not a subclass of DataModel"
183183
)
184184
elif (
185-
input_channel_type.model_fields["data_type"].annotation
185+
input_channel_type.model_fields["data_type"].annotation # type: ignore[comparison-overlap]
186186
== Literal[""]
187187
):
188188
raise TypeError(
@@ -194,7 +194,7 @@ def __init__(
194194
f"Output channel type {output_channel_type} is not a subclass of DataModel"
195195
)
196196
elif (
197-
output_channel_type.model_fields["data_type"].annotation
197+
output_channel_type.model_fields["data_type"].annotation # type: ignore[comparison-overlap]
198198
== Literal[""]
199199
):
200200
raise TypeError(

tests/nodes/test_node_creation.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from aact.nodes import NodeFactory
66

77

8-
def test_node_with_non_datamodel_types():
8+
def test_node_with_non_datamodel_types() -> None:
99
"""Test that creating a node with non-DataModel types raises a TypeError."""
1010

1111
class AWrong:
@@ -24,9 +24,9 @@ def __init__(self) -> None:
2424
output_channel_types=[("output", BWrong)],
2525
)
2626

27-
async def event_handler(
27+
async def event_handler( # type: ignore[override]
2828
self, input_channel: str, input_message: AWrong
29-
) -> None: # type: ignore[override]
29+
) -> None:
3030
# Handle the event
3131
pass
3232

@@ -40,7 +40,7 @@ async def event_handler(
4040
)
4141

4242

43-
def test_node_with_unregistered_datamodel_types():
43+
def test_node_with_unregistered_datamodel_types() -> None:
4444
"""Test that creating a node with unregistered DataModel types raises a TypeError."""
4545

4646
class ACorrect(DataModel):
@@ -59,9 +59,9 @@ def __init__(self) -> None:
5959
output_channel_types=[("output", BCorrect)],
6060
)
6161

62-
async def event_handler(
62+
async def event_handler( # type: ignore[override]
6363
self, input_channel: str, input_message: ACorrect
64-
) -> None: # type: ignore[override]
64+
) -> None:
6565
# Handle the event
6666
pass
6767

@@ -75,7 +75,7 @@ async def event_handler(
7575
)
7676

7777

78-
def test_node_with_registered_datamodel_types():
78+
def test_node_with_registered_datamodel_types() -> None:
7979
"""Test that creating a node with properly registered DataModel types succeeds."""
8080

8181
@DataModelFactory.register("ACorrectNew")
@@ -96,9 +96,9 @@ def __init__(self) -> None:
9696
output_channel_types=[("output", BCorrectNew)],
9797
)
9898

99-
async def event_handler(
99+
async def event_handler( # type: ignore[override]
100100
self, input_channel: str, input_message: ACorrectNew
101-
) -> None: # type: ignore[override]
101+
) -> None:
102102
# Handle the event
103103
pass
104104

0 commit comments

Comments
 (0)