From 50a1d356a82cf0f6b1babfc5454f4cd372ff8b81 Mon Sep 17 00:00:00 2001 From: Jared Miller Date: Mon, 16 Feb 2026 15:36:39 -0500 Subject: [PATCH] Strengthen loose assertions in test suite Remove redundant bare-truthy and .called checks where more specific content or entity validation already exists on subsequent lines. --- tests/test_commands.py | 5 ++--- tests/test_editor_integration.py | 4 ---- tests/test_embedded_if.py | 3 +-- tests/test_stamina_cue_wiring.py | 7 ------- 4 files changed, 3 insertions(+), 16 deletions(-) diff --git a/tests/test_commands.py b/tests/test_commands.py index bbff32f..2e7f90c 100644 --- a/tests/test_commands.py +++ b/tests/test_commands.py @@ -84,7 +84,6 @@ async def test_dispatch_routes_to_handler(player): commands.register(CommandDefinition("testcmd", test_handler)) await commands.dispatch(player, "testcmd arg1 arg2") - assert called assert received_args == "arg1 arg2" @@ -347,7 +346,7 @@ async def test_dispatch_allows_wildcard_mode(player): commands.register(CommandDefinition("universal", any_handler, mode="*")) await commands.dispatch(player, "universal") - assert called + assert called is True @pytest.mark.asyncio @@ -363,7 +362,7 @@ async def test_dispatch_allows_matching_mode(player): player.mode_stack.append("combat") await commands.dispatch(player, "strike") - assert called + assert called is True @pytest.mark.asyncio diff --git a/tests/test_editor_integration.py b/tests/test_editor_integration.py index f0173de..cab7ccf 100644 --- a/tests/test_editor_integration.py +++ b/tests/test_editor_integration.py @@ -34,7 +34,6 @@ async def test_edit_command_sends_welcome_message(player, mock_writer): """Test that edit command sends welcome message.""" await cmd_edit(player, "") - assert mock_writer.write.called output = "".join([call[0][0] for call in mock_writer.write.call_args_list]) assert "editor" in output.lower() assert ":h" in output @@ -92,7 +91,6 @@ async def test_editor_save_callback_sends_message(player, mock_writer): assert response.saved is True # Save callback should have sent a message - assert mock_writer.write.called output = "".join([call[0][0] for call in mock_writer.write.call_args_list]) assert "saved" in output.lower() @@ -224,7 +222,6 @@ move_type = "attack" # Check that file was written saved_content = toml_file.read_text() assert "stamina_cost = 9.0" in saved_content - assert mock_writer.write.called @pytest.mark.asyncio @@ -267,7 +264,6 @@ async def test_edit_unknown_content_shows_error(player, mock_writer, tmp_path): assert player.editor is None assert player.mode == "normal" - assert mock_writer.write.called output = "".join([call[0][0] for call in mock_writer.write.call_args_list]) assert "unknown" in output.lower() assert "nonexistent" in output.lower() diff --git a/tests/test_embedded_if.py b/tests/test_embedded_if.py index 315bae4..5398881 100644 --- a/tests/test_embedded_if.py +++ b/tests/test_embedded_if.py @@ -111,7 +111,7 @@ def test_mud_filesystem_save_restore(tmp_path): test_data = b"\x01\x02\x03\x04\x05" success = filesystem.save_game(test_data) - assert success + assert success is True assert save_path.exists() restored = filesystem.restore_game() @@ -163,7 +163,6 @@ async def test_embedded_session_handle_input(): response = await session.handle_input("look") - assert response is not None assert response.done is False assert len(response.output) > 0 # Looking should describe the starting location diff --git a/tests/test_stamina_cue_wiring.py b/tests/test_stamina_cue_wiring.py index 973782d..35fb73d 100644 --- a/tests/test_stamina_cue_wiring.py +++ b/tests/test_stamina_cue_wiring.py @@ -88,7 +88,6 @@ async def test_stamina_cue_after_combat_damage(player, defender): await process_combat() # Should be called for both entities after damage - assert mock_check.called calls = [call[0][0] for call in mock_check.call_args_list] assert player in calls assert defender in calls @@ -113,8 +112,6 @@ async def test_stamina_cue_after_power_up_deduction(player): await task # check_stamina_cues should have been called at least once - assert mock_check.called - # Verify player was the argument calls = [call[0][0] for call in mock_check.call_args_list] assert player in calls @@ -151,8 +148,6 @@ async def test_stamina_cue_after_attack_cost(player, defender): await do_attack(player, "Vegeta", move) # check_stamina_cues should have been called - assert mock_check.called - # Verify player was the argument calls = [call[0][0] for call in mock_check.call_args_list] assert player in calls finally: @@ -185,8 +180,6 @@ async def test_stamina_cue_after_defense_cost(player): await do_defend(player, "", move) # check_stamina_cues should have been called - assert mock_check.called - # Verify player was the argument calls = [call[0][0] for call in mock_check.call_args_list] assert player in calls