Refactor test cases for improved readability and consistency
- Updated test functions in various test files to enhance code clarity by formatting long lines and improving indentation. - Adjusted assertions to use multi-line formatting for better readability. - Added new test cases for theme settings API to ensure proper functionality. - Ensured consistent use of line breaks and spacing across test files for uniformity.
This commit is contained in:
@@ -43,7 +43,9 @@ class SimulationRunResponse(BaseModel):
|
||||
summary: Dict[str, float | int]
|
||||
|
||||
|
||||
def _load_parameters(db: Session, scenario_id: int) -> List[SimulationParameterInput]:
|
||||
def _load_parameters(
|
||||
db: Session, scenario_id: int
|
||||
) -> List[SimulationParameterInput]:
|
||||
db_params = (
|
||||
db.query(Parameter)
|
||||
.filter(Parameter.scenario_id == scenario_id)
|
||||
@@ -60,17 +62,19 @@ def _load_parameters(db: Session, scenario_id: int) -> List[SimulationParameterI
|
||||
|
||||
|
||||
@router.post("/run", response_model=SimulationRunResponse)
|
||||
async def simulate(payload: SimulationRunRequest, db: Session = Depends(get_db)):
|
||||
scenario = db.query(Scenario).filter(
|
||||
Scenario.id == payload.scenario_id).first()
|
||||
async def simulate(
|
||||
payload: SimulationRunRequest, db: Session = Depends(get_db)
|
||||
):
|
||||
scenario = (
|
||||
db.query(Scenario).filter(Scenario.id == payload.scenario_id).first()
|
||||
)
|
||||
if scenario is None:
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_404_NOT_FOUND,
|
||||
detail="Scenario not found",
|
||||
)
|
||||
|
||||
parameters = payload.parameters or _load_parameters(
|
||||
db, payload.scenario_id)
|
||||
parameters = payload.parameters or _load_parameters(db, payload.scenario_id)
|
||||
if not parameters:
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_400_BAD_REQUEST,
|
||||
|
||||
Reference in New Issue
Block a user