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.
This commit is contained in:
Jared Miller 2026-02-16 15:36:39 -05:00
parent 87b971abcc
commit 50a1d356a8
Signed by: shmup
GPG key ID: 22B5C6D66A38B06C
4 changed files with 3 additions and 16 deletions

View file

@ -84,7 +84,6 @@ async def test_dispatch_routes_to_handler(player):
commands.register(CommandDefinition("testcmd", test_handler)) commands.register(CommandDefinition("testcmd", test_handler))
await commands.dispatch(player, "testcmd arg1 arg2") await commands.dispatch(player, "testcmd arg1 arg2")
assert called
assert received_args == "arg1 arg2" assert received_args == "arg1 arg2"
@ -347,7 +346,7 @@ async def test_dispatch_allows_wildcard_mode(player):
commands.register(CommandDefinition("universal", any_handler, mode="*")) commands.register(CommandDefinition("universal", any_handler, mode="*"))
await commands.dispatch(player, "universal") await commands.dispatch(player, "universal")
assert called assert called is True
@pytest.mark.asyncio @pytest.mark.asyncio
@ -363,7 +362,7 @@ async def test_dispatch_allows_matching_mode(player):
player.mode_stack.append("combat") player.mode_stack.append("combat")
await commands.dispatch(player, "strike") await commands.dispatch(player, "strike")
assert called assert called is True
@pytest.mark.asyncio @pytest.mark.asyncio

View file

@ -34,7 +34,6 @@ async def test_edit_command_sends_welcome_message(player, mock_writer):
"""Test that edit command sends welcome message.""" """Test that edit command sends welcome message."""
await cmd_edit(player, "") await cmd_edit(player, "")
assert mock_writer.write.called
output = "".join([call[0][0] for call in mock_writer.write.call_args_list]) output = "".join([call[0][0] for call in mock_writer.write.call_args_list])
assert "editor" in output.lower() assert "editor" in output.lower()
assert ":h" in output assert ":h" in output
@ -92,7 +91,6 @@ async def test_editor_save_callback_sends_message(player, mock_writer):
assert response.saved is True assert response.saved is True
# Save callback should have sent a message # 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]) output = "".join([call[0][0] for call in mock_writer.write.call_args_list])
assert "saved" in output.lower() assert "saved" in output.lower()
@ -224,7 +222,6 @@ move_type = "attack"
# Check that file was written # Check that file was written
saved_content = toml_file.read_text() saved_content = toml_file.read_text()
assert "stamina_cost = 9.0" in saved_content assert "stamina_cost = 9.0" in saved_content
assert mock_writer.write.called
@pytest.mark.asyncio @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.editor is None
assert player.mode == "normal" assert player.mode == "normal"
assert mock_writer.write.called
output = "".join([call[0][0] for call in mock_writer.write.call_args_list]) output = "".join([call[0][0] for call in mock_writer.write.call_args_list])
assert "unknown" in output.lower() assert "unknown" in output.lower()
assert "nonexistent" in output.lower() assert "nonexistent" in output.lower()

View file

@ -111,7 +111,7 @@ def test_mud_filesystem_save_restore(tmp_path):
test_data = b"\x01\x02\x03\x04\x05" test_data = b"\x01\x02\x03\x04\x05"
success = filesystem.save_game(test_data) success = filesystem.save_game(test_data)
assert success assert success is True
assert save_path.exists() assert save_path.exists()
restored = filesystem.restore_game() restored = filesystem.restore_game()
@ -163,7 +163,6 @@ async def test_embedded_session_handle_input():
response = await session.handle_input("look") response = await session.handle_input("look")
assert response is not None
assert response.done is False assert response.done is False
assert len(response.output) > 0 assert len(response.output) > 0
# Looking should describe the starting location # Looking should describe the starting location

View file

@ -88,7 +88,6 @@ async def test_stamina_cue_after_combat_damage(player, defender):
await process_combat() await process_combat()
# Should be called for both entities after damage # Should be called for both entities after damage
assert mock_check.called
calls = [call[0][0] for call in mock_check.call_args_list] calls = [call[0][0] for call in mock_check.call_args_list]
assert player in calls assert player in calls
assert defender in calls assert defender in calls
@ -113,8 +112,6 @@ async def test_stamina_cue_after_power_up_deduction(player):
await task await task
# check_stamina_cues should have been called at least once # 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] calls = [call[0][0] for call in mock_check.call_args_list]
assert player in calls assert player in calls
@ -151,8 +148,6 @@ async def test_stamina_cue_after_attack_cost(player, defender):
await do_attack(player, "Vegeta", move) await do_attack(player, "Vegeta", move)
# check_stamina_cues should have been called # 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] calls = [call[0][0] for call in mock_check.call_args_list]
assert player in calls assert player in calls
finally: finally:
@ -185,8 +180,6 @@ async def test_stamina_cue_after_defense_cost(player):
await do_defend(player, "", move) await do_defend(player, "", move)
# check_stamina_cues should have been called # 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] calls = [call[0][0] for call in mock_check.call_args_list]
assert player in calls assert player in calls