Skip to content

Conversation

devin-ai-integration[bot]
Copy link
Contributor

@devin-ai-integration devin-ai-integration bot commented Jun 7, 2025

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

  1. 文字列のを含んでいる - assert_string_contains(expected: str)

    • Checks if actual string contains expected substring
    • Similar to existing "文字列のである" assertion
  2. 小数値のである - assert_float_value(expected: str)

    • Checks if actual value equals expected float value
    • Similar to existing "整数値のである" assertion
  3. 整数値の以上である - assert_int_greater_equal(threshold: str)

    • Checks if actual integer is greater than or equal to threshold
    • Similar to existing "整数値のである" assertion
  4. 偽である - assert_false_value()

    • Checks if actual value is False
    • Similar to existing "真である" assertion
  5. 真偽値のである - assert_bool_value()

    • Checks if actual value is instance of bool type
    • Similar to existing "真である" assertion
  6. nullである - assert_null_value()

    • Checks if actual value is None
    • Similar to existing "真である" assertion

Implementation Details

  • All assertions follow the existing pattern using @step decorator and data_store.spec.pop("actual")
  • Each assertion includes comprehensive test coverage with pass and fail scenarios
  • 6 separate commits were created as requested in the issue
  • All 18 tests pass (6 existing + 12 new)

Testing

python -m pytest tests/steps/test_core.py -v

All tests pass successfully.

Link to Devin run: https://app.devin.ai/sessions/3ffa81952541401e942595bf29ae78bc
Requested by: nikkie

devin-ai-integration bot and others added 6 commits June 7, 2025 03:27
- 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>
Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

- 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>
@ftnext ftnext requested a review from Copilot June 8, 2025 08:08
Copy link

@Copilot Copilot AI left a 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

assert actual == expected_float, f"Expected {expected_float!r} but got {actual!r}" # noqa: S101


@step("整数値の<threshold>以上である")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

引数名を threshold から expected に変えて、統一しましょう

assert actual is False, f"Expected False but got {actual!r}" # noqa: S101


@step("真偽値のである")
Copy link
Owner

@ftnext ftnext Jun 8, 2025

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>
@ftnext ftnext merged commit 5531be3 into main Jun 8, 2025
1 check passed
@ftnext ftnext deleted the devin/1749266587-add-core-assertions branch June 8, 2025 08:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

本家のcoreにあるassetionのうち未実装で、既存実装と同様なものを追加する
1 participant