-
Notifications
You must be signed in to change notification settings - Fork 122
Description
Description of the task
High Level Overview
This task addresses the use of the OrValidation class in enemy_free_kick_play_test. OrValidation is used as a logical OR between validations of the same type. The current enemy_free_kick_play_test passes validations of different types (an always validation and eventually validation) to OrValidation.
This previously passed CI because same type checking was only added to OrValidation by #3123. The reason OrValidation is not able to act as a logical OR for tests of different test types is because it extends the Validation class, which classifies and runs always validations and eventually validations separately.
Detailed Description of Issue
The issue with enemy_free_kick_play_test is here:
# Always Validation
always_validation_sequence_set = [
[
OrValidation(
[
RobotNeverEntersRegion(
regions=[tbots_cpp.Circle(ball_initial_pos, 0.05)]
),
BallEventuallyMovesFromRest(position=ball_initial_pos),
]
)
]
]
Above, we see an OrValidation passed both an always validation and eventually validation - this causes type checking within the OrValidation class to raise a TypeError. Further, this OrValidation is called within the always_validation_sequence_set, which cannot call an eventually validation.
The test is currently prevented from executing to stop CI from failing. This is done with the following code snippet:
@pytest.mark.skip(
"Disabling this test because OrValidation is passed both an always validation and eventually validation"
)
To execute the test, the above code snippet needs to be removed so that CI runs the test again.
Potential Solutions
There are two main ways to address this issue:
- Rewrite
enemy_kickoff_play_testso that always validations and eventually validations are separated and placed within their respectiive validation sets. Remove theOrValidationaltogether. - Modify
OrValidationand/orValidationso thatOrValidationcan accept both eventually and always validations as parameters.
Acceptance criteria
-
enemy_free_kick_play_testensures enemy free kick does not break any rules (can infer what these rules are based on the current code OR through the rulebook OR asking Andrew who wroteenemy_free_kick_play_test). - Add code comments to
enemy_free_kick_play_testto explain what it's checking specifically - pytest.mark.skip is removed so the test can be executed again
-
OrValidationno longer throws TypeError -
enemy_free_kick_play_testpasses when executed (assuming the simulation behaviour is correct)