← Về thư mục
tests/stable-baselines3/test_scripts.py
- placed_env · function · L65-L71 — def placed_env(agent, goal, grid_size=5, render_mode=None)
- SpaceDefinitionTests · class · L74-L93 — class SpaceDefinitionTests(unittest.TestCase)
- test_the_action_space_is_the_four_documented_moves · method · L75-L76 — def test_the_action_space_is_the_four_documented_moves(self) -> None
- test_the_observation_box_spans_the_grid_and_is_float32 · method · L78-L87 — def test_the_observation_box_spans_the_grid_and_is_float32(self) -> None: # SB3 expects float32 observations; float64 silently costs a conversion # warning at best and a space mismatch at worst.
- test_the_metadata_declares_the_render_modes_it_implements · method · L89-L93 — def test_the_metadata_declares_the_render_modes_it_implements(self) -> None
- ResetTests · class · L96-L132 — class ResetTests(unittest.TestCase)
- test_the_same_seed_gives_the_same_starting_layout · method · L97-L103 — def test_the_same_seed_gives_the_same_starting_layout(self) -> None
- test_different_seeds_give_different_layouts · method · L105-L110 — def test_different_seeds_give_different_layouts(self) -> None
- test_the_goal_never_starts_on_the_agent · method · L112-L120 — def test_the_goal_never_starts_on_the_agent(self) -> None: # reset() loops until they differ; otherwise the episode would be over # before it began.
- test_the_observation_is_the_agent_position_and_lies_in_the_space · method · L122-L126 — def test_the_observation_is_the_agent_position_and_lies_in_the_space(self) -> None
- test_the_info_distance_is_the_euclidean_distance_to_the_goal · method · L128-L132 — def test_the_info_distance_is_the_euclidean_distance_to_the_goal(self) -> None
- StepTests · class · L135-L184 — class StepTests(unittest.TestCase)
- test_each_action_moves_one_cell_in_its_documented_direction · method · L136-L145 — def test_each_action_moves_one_cell_in_its_documented_direction(self) -> None
- test_moves_are_clipped_at_every_edge · method · L147-L155 — def test_moves_are_clipped_at_every_edge(self) -> None: # Walking into a wall must be a no-op, not an out-of-space observation.
- test_reaching_the_goal_pays_one_and_terminates · method · L157-L162 — def test_reaching_the_goal_pays_one_and_terminates(self) -> None
- test_not_reaching_the_goal_costs_a_tenth_of_the_distance · method · L164-L170 — def test_not_reaching_the_goal_costs_a_tenth_of_the_distance(self) -> None: # From (2, 2) moving up lands on (1, 2); the goal at (4, 4) is then # sqrt(9 + 4) = 3.6055... away, so the reward is -0.36055...
- test_the_step_penalty_shrinks_as_the_agent_closes_in · method · L172-L175 — def test_the_step_penalty_shrinks_as_the_agent_closes_in(self) -> None
- test_the_raw_environment_never_truncates_on_its_own · method · L177-L184 — def test_the_raw_environment_never_truncates_on_its_own(self) -> None: # The template says the time limit comes from registration, not step().
- RegistrationTests · class · L187-L210 — class RegistrationTests(unittest.TestCase)
- test_the_environment_is_registered_under_its_documented_id · method · L188-L189 — def test_the_environment_is_registered_under_its_documented_id(self) -> None
- test_gym_make_applies_the_hundred_step_time_limit · method · L191-L193 — def test_gym_make_applies_the_hundred_step_time_limit(self) -> None
- test_an_episode_that_never_reaches_the_goal_truncates_at_one_hundred · method · L195-L210 — def test_an_episode_that_never_reaches_the_goal_truncates_at_one_hundred(self) -> None: # Park the agent in the top row and keep pressing up: it can never reach # a goal in the bottom-right corner, so only the time limit ends this.
- EnvCheckerTests · class · L213-L235 — class EnvCheckerTests(unittest.TestCase)
- test_the_template_passes_sb3s_checker_without_warnings · method · L214-L218 — def test_the_template_passes_sb3s_checker_without_warnings(self) -> None
- test_the_checker_rejects_an_observation_outside_the_declared_space · method · L220-L228 — def test_the_checker_rejects_an_observation_outside_the_declared_space(self) -> None: # The other direction: without this, "check_env passed" would only prove # the checker ran.
- WrongDtypeEnv · class · L223-L225 — class WrongDtypeEnv(custom_env_template.CustomEnv)
- _get_obs · method · L224-L225 — def _get_obs(self)
- test_the_validate_helper_runs_the_checker_on_the_template · method · L230-L235 — def test_the_validate_helper_runs_the_checker_on_the_template(self) -> None: # The helper is what the demo block calls; it must not print a failure.
- RenderTests · class · L238-L257 — class RenderTests(unittest.TestCase)
- test_human_rendering_draws_the_agent_and_the_goal · method · L239-L247 — def test_human_rendering_draws_the_agent_and_the_goal(self) -> None
- test_rgb_rendering_returns_a_fifty_pixel_cell_canvas · method · L249-L253 — def test_rgb_rendering_returns_a_fifty_pixel_cell_canvas(self) -> None
- test_rendering_is_a_no_op_when_no_mode_was_requested · method · L255-L257 — def test_rendering_is_a_no_op_when_no_mode_was_requested(self) -> None
- train_tiny_agent · function · L260-L274 — def train_tiny_agent(directory: Path) -> Path
- EvaluationTests · class · L277-L341 — class EvaluationTests(unittest.TestCase)
- setUpClass · method · L279-L281 — def setUpClass(cls) -> None
- tearDownClass · method · L284-L285 — def tearDownClass(cls) -> None
- test_evaluation_returns_a_mean_and_a_non_negative_spread · method · L287-L295 — def test_evaluation_returns_a_mean_and_a_non_negative_spread(self) -> None
- test_the_score_is_an_average_of_whole_cartpole_episodes · method · L297-L305 — def test_the_score_is_an_average_of_whole_cartpole_episodes(self) -> None: # CartPole pays exactly 1 per surviving step, so the mean of n episodes # is a multiple of 1/n. The helper takes no seed, so the value itself # varies between calls -- its arithmetic must not.
- test_a_single_episode_has_no_spread · method · L307-L311 — def test_a_single_episode_has_no_spread(self) -> None
- test_a_missing_normalisation_file_is_ignored_rather_than_fatal · method · L313-L320 — def test_a_missing_normalisation_file_is_ignored_rather_than_fatal(self) -> None
- test_comparing_models_reports_one_row_per_path · method · L322-L335 — def test_comparing_models_reports_one_row_per_path(self) -> None: # The results are keyed by path, so the same checkpoint twice collapses # to one entry rather than silently overwriting a different model's row.
- test_loading_a_model_that_does_not_exist_fails_loudly · method · L337-L341 — def test_loading_a_model_that_does_not_exist_fails_loudly(self) -> None
- TrainingPipelineTests · class · L363-L407 — class TrainingPipelineTests(unittest.TestCase)
- test_the_template_trains_and_saves_a_loadable_model · method · L366-L407 — def test_the_template_trains_and_saves_a_loadable_model(self) -> None