MCPcopy Create free account
hub / github.com/bhowiebkr/PyFlowGraph / test_command_undo

Method test_command_undo

tests/test_group_system.py:313–333  ·  view source on GitHub ↗

Test successful command undo.

(self, mock_get_group_class)

Source from the content-addressed store, hash-verified

311
312 @patch.object(CreateGroupCommand, '_get_group_class')
313 def test_command_undo(self, mock_get_group_class):
314 """Test successful command undo."""
315 # Setup and execute command first
316 mock_group_class = Mock()
317 mock_group = Mock()
318 mock_group.name = "Test Group"
319 mock_group.member_node_uuids = ["uuid1", "uuid2"]
320 mock_group.scene.return_value = self.mock_scene
321 mock_group.calculate_bounds_from_members = Mock()
322 mock_group_class.return_value = mock_group
323 mock_get_group_class.return_value = mock_group_class
324
325 command = CreateGroupCommand(self.mock_scene, self.group_properties)
326 command.execute()
327
328 # Test undo
329 result = command.undo()
330
331 self.assertTrue(result)
332 self.mock_scene.removeItem.assert_called_with(mock_group)
333 self.assertNotIn(mock_group, self.mock_scene.groups)
334
335 @patch.object(CreateGroupCommand, '_get_group_class')
336 def test_command_redo(self, mock_get_group_class):

Callers

nothing calls this directly

Calls 3

executeMethod · 0.95
undoMethod · 0.95
CreateGroupCommandClass · 0.90

Tested by

no test coverage detected