File tree Expand file tree Collapse file tree 2 files changed +10
-7
lines changed
Expand file tree Collapse file tree 2 files changed +10
-7
lines changed Original file line number Diff line number Diff line change 1+ 3.10
Original file line number Diff line number Diff line change @@ -950,19 +950,21 @@ class TestNodeEdgeCases:
950950
951951 def test_node_type_hints_exception (self ) -> None :
952952 """Test exception handling when getting type hints fails."""
953+ import sys
954+ from unittest .mock import patch
955+
956+ from dag_simple .node import Node
953957
954958 # Create a function with missing type hints to simulate problematic type hints
955959 def problematic_func (x : object ) -> object :
956960 return x
957961
958- from unittest .mock import patch
959-
960- from dag_simple .node import Node
961-
962- with patch ("dag_simple.node.get_type_hints" , side_effect = Exception ("Type hint error" )):
962+ # Patch get_type_hints where it's used in the node module
963+ # We need to patch the already-imported reference
964+ with patch .object (sys .modules ["dag_simple.node" ], "get_type_hints" , side_effect = Exception ("Type hint error" )):
963965 # This should not raise an exception, but should disable validation
964- node = Node (problematic_func , validate_types = True )
965- assert node .validate_types is False
966+ node_instance = Node (problematic_func , validate_types = True )
967+ assert node_instance .validate_types is False
966968
967969 def test_node_repr (self ) -> None :
968970 """Test Node __repr__ method."""
You can’t perform that action at this time.
0 commit comments