tests: Add adapter-level tests for merels via game_handler (fixes #433)#5
Closed
joshishiv4 wants to merge 3 commits into
Closed
tests: Add adapter-level tests for merels via game_handler (fixes #433)#5joshishiv4 wants to merge 3 commits into
joshishiv4 wants to merge 3 commits into
Conversation
Mirror the style used by connect_four to exercise the GameAdapter flow for Merels. Use stable fragments to avoid brittleness. Included: - help shows Merels help - start game posts an invite with “wants to play”, “Merels”, “join” - join triggers start message (containment) - light checks for MerelsMessageHandler helpers No production changes; tests only. Fixes #433.
Combine the adapter-flow tests with the existing Merels bot tests to keep the suite cohesive, mirroring connect_four. Replace brittle exact-string checks with stable substring assertions. Remove obsolete FIXME/TODO notes. No production code changes; tests only. All suites pass locally. Fixes #433.
Merels previously had adapter-focused tests for help/start/join, but the move path through GameAdapter was untested. This adds a small in-file test helper to drive the adapter and a test that starts a 2-player game, sends a move, counts model.make_move calls, and asserts that the bot replies. This covers the 'test lib for game_handler' FIXME. I did not add 'computer move' tests, because the Merels bot declares supports_computer = False; there is no single-player/computer flow to exercise. I left a comment in above TestMerelsAdapter that clarifies this. No production changes; tests only. Passes local pytest, mypy, and lint. Fixes #433.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
tests: Add adapter-level tests for Merels via game_handler.
Mirror the style used by
connect_fourto exercise theGameAdapterflow for Merels. Assert on stable fragments to avoid brittle failures
when wording changes.
Included:
MerelsMessageHandlerhelpers:parse_boardidentityget_player_coloralert_move_messageformattingOut of scope:
Rationale / approach:
connect_four/test_connect_four.pystructure (BotTestCase,transcript scanning) to test the adapter path users exercise in practice.
How did you test this PR?
Notes:
configuration; it only adds tests under
zulip_bots/.../merels/.Fixes #433.
Recreated from zulip/python-zulip-api#891
⚠ This PR was MERGED upstream.
Merged at: 2025-12-16T23:50:53Z