Skip to content

Commit de39974

Browse files
Copilotminitriga
andcommitted
Use __future__ annotations and add changelog for issue 630
- Added `from __future__ import annotations` to enable postponed evaluation - Changed `clients: "BothClients"` to `clients: BothClients` without string quotes - Moved GenericSchema, NodeSchemaAPI, and HTTPXMock imports to TYPE_CHECKING block - Added changelog/630.fixed.md documenting the fix Co-authored-by: minitriga <[email protected]>
1 parent dd24d0f commit de39974

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

changelog/630.fixed.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fixed SDK including explicit `null` values for uninitialized optional relationships when creating nodes with object templates, which prevented the backend from applying template defaults.

tests/unit/sdk/test_node.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
import inspect
24
import ipaddress
35
from typing import TYPE_CHECKING
@@ -16,10 +18,12 @@
1618
)
1719
from infrahub_sdk.node.constants import SAFE_VALUE
1820
from infrahub_sdk.node.related_node import RelatedNode, RelatedNodeSync
19-
from infrahub_sdk.schema import GenericSchema, NodeSchemaAPI
2021

2122
if TYPE_CHECKING:
23+
from pytest_httpx import HTTPXMock
24+
2225
from infrahub_sdk.client import InfrahubClient, InfrahubClientSync
26+
from infrahub_sdk.schema import GenericSchema, NodeSchemaAPI
2327

2428
from .conftest import BothClients
2529

@@ -1400,7 +1404,7 @@ async def test_create_input_data_with_dropdown(client, location_schema_with_drop
14001404

14011405
@pytest.mark.parametrize("client_type", client_types)
14021406
async def test_update_input_data_existing_node_with_optional_relationship(
1403-
clients: "BothClients", location_schema: NodeSchemaAPI, client_type: str
1407+
clients: BothClients, location_schema: NodeSchemaAPI, client_type: str
14041408
) -> None:
14051409
"""Validate that existing nodes include None for uninitialized optional relationships.
14061410

0 commit comments

Comments
 (0)