Spaces:
Sleeping
Sleeping
| # Copyright (c) Meta Platforms, Inc. and affiliates. | |
| # All rights reserved. | |
| # | |
| # This source code is licensed under the BSD-style license found in the | |
| # LICENSE file in the root directory of this source tree. | |
| """ | |
| Data models for the Unittestcasegenerator Environment. | |
| The UnitTestCaseGenerator environment is a simple test environment that echoes back messages. | |
| """ | |
| from typing import Optional | |
| from openenv.core.env_server.types import Action, Observation | |
| from pydantic import Field | |
| class UnittestcasegeneratorAction(Action): | |
| """Action for the Unittestcasegenerator environment - just a message to echo.""" | |
| test_code: str = Field(..., description="Java JUnit test code") | |
| class UnittestcasegeneratorObservation(Observation): | |
| """Observation from the Unittestcasegenerator environment - the echoed message.""" | |
| source_code: str = Field(..., description="Java source code to test") | |
| task_hint: str = Field(..., description="Instructions for writing tests") | |
| passed: int = Field(default=0, description="Tests passed") | |
| failed: int = Field(default=0, description="Tests failed") | |
| total: int = Field(default=0, description="Total tests run") | |
| error: Optional[str] = Field(default=None, description="Error message if any") | |
| reward: float = Field(default=0.0, description="Score 0.0 to 1.0") | |
| done: bool = Field(default=False, description="Episode finished?") | |
| metadata: Optional[dict] = Field(default=None) |