-
Notifications
You must be signed in to change notification settings - Fork 0
Add 6 new core assertions to playtest2-python #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Add assert_string_contains function with @step decorator - Add test cases for pass and fail scenarios - Checks if actual string contains expected substring Co-Authored-By: nikkie <takuyafjp+develop@gmail.com>
- Add assert_float_value function with @step decorator - Add test cases for pass and fail scenarios - Converts expected parameter to float for comparison Co-Authored-By: nikkie <takuyafjp+develop@gmail.com>
- Add assert_int_greater_equal function with @step decorator - Add test cases for pass, equal, and fail scenarios - Checks if actual integer is greater than or equal to threshold Co-Authored-By: nikkie <takuyafjp+develop@gmail.com>
- Add assert_false_value function with @step decorator - Add test cases for pass and fail scenarios - Checks if actual value is False Co-Authored-By: nikkie <takuyafjp+develop@gmail.com>
- Add assert_bool_value function with @step decorator - Add test cases for True, False, and non-bool scenarios - Checks if actual value is instance of bool type Co-Authored-By: nikkie <takuyafjp+develop@gmail.com>
- Add assert_null_value function with @step decorator - Add test cases for pass and fail scenarios - Checks if actual value is None Co-Authored-By: nikkie <takuyafjp+develop@gmail.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
- Use separate variables for type conversions to avoid reassignment - expected_int, expected_float, threshold_int instead of reassigning parameters - Resolves mypy assignment type errors while maintaining functionality Co-Authored-By: nikkie <takuyafjp+develop@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds 6 new assertion functions in the core module to support additional test scenarios as requested in issue #1.
- Added new assertion functions: assert_string_contains, assert_float_value, assert_int_greater_equal, assert_false_value, assert_bool_value, and assert_null_value.
- Extended the test suite with pass/fail scenarios for each new assertion to ensure comprehensive coverage.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
File | Description |
---|---|
tests/steps/test_core.py | Added tests for all new assertion functions ensuring proper behavior |
src/playtest2/steps/core.py | Implemented 6 new assertion functions following existing patterns |
src/playtest2/steps/core.py
Outdated
assert actual == expected_float, f"Expected {expected_float!r} but got {actual!r}" # noqa: S101 | ||
|
||
|
||
@step("整数値の<threshold>以上である") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
引数名を threshold から expected に変えて、統一しましょう
src/playtest2/steps/core.py
Outdated
assert actual is False, f"Expected False but got {actual!r}" # noqa: S101 | ||
|
||
|
||
@step("真偽値のである") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MUST: 「真偽値の<expected>である
」として再実装しましょう
以下の2ケースを想定して実装すれば十分と考えています
- 真偽値のTrueである
- 真偽値のFalseである
- Change 'threshold' to 'expected' parameter in assert_int_greater_equal for consistency - Change '真偽値のである' to '真偽値の<expected>である' with parameter support - Support 'True' and 'False' string parameters for boolean assertion - Update corresponding test cases to match new function signatures - All 20 tests pass Co-Authored-By: nikkie <takuyafjp+develop@gmail.com>
Add 6 new core assertions to playtest2-python
This PR implements 6 new assertion functions in the core module as requested in issue #1.
Implemented Assertions
文字列のを含んでいる -
assert_string_contains(expected: str)
小数値のである -
assert_float_value(expected: str)
整数値の以上である -
assert_int_greater_equal(threshold: str)
偽である -
assert_false_value()
真偽値のである -
assert_bool_value()
nullである -
assert_null_value()
Implementation Details
@step
decorator anddata_store.spec.pop("actual")
Testing
All tests pass successfully.
Link to Devin run: https://app.devin.ai/sessions/3ffa81952541401e942595bf29ae78bc
Requested by: nikkie