Skip to content

Commit

Permalink
chore: correct style in source code
Browse files Browse the repository at this point in the history
  • Loading branch information
laurent-laporte-pro committed Apr 2, 2024
1 parent 9797944 commit fce46c6
Show file tree
Hide file tree
Showing 13 changed files with 14 additions and 25 deletions.
2 changes: 1 addition & 1 deletion tests/integration/studies_blueprint/test_comments.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def test_variant_study(
res = client.post(
f"/v1/studies/{base_study_id}/variants",
headers={"Authorization": f"Bearer {user_access_token}"},
params={"name": f"Variant XYZ"},
params={"name": "Variant XYZ"},
)
assert res.status_code == 200, res.json() # should be CREATED
variant_id = res.json()
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/studies_blueprint/test_synthesis.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def test_variant_study(
res = client.post(
f"/v1/studies/{base_study_id}/variants",
headers={"Authorization": f"Bearer {user_access_token}"},
params={"name": f"Variant XYZ"},
params={"name": "Variant XYZ"},
)
assert res.status_code == 200, res.json() # should be CREATED
variant_id = res.json()
Expand Down
10 changes: 2 additions & 8 deletions tests/integration/test_integration_watcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,5 @@ def test_integration_xpansion(app: FastAPI, tmp_path: str):
admin_credentials = res.json()
headers = {"Authorization": f'Bearer {admin_credentials["access_token"]}'}

client.post(
f"/v1/watcher/_scan",
headers=headers,
)
client.post(
f"/v1/watcher/_scan?path=/tmp",
headers=headers,
)
client.post("/v1/watcher/_scan", headers=headers)
client.post("/v1/watcher/_scan?path=/tmp", headers=headers)
2 changes: 1 addition & 1 deletion tests/launcher/test_web.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def test_jobs() -> None:
assert res.status_code == 200
assert [JobResultDTO.parse_obj(j) for j in res.json()] == [result.to_dto()]

res = client.get(f"/v1/launcher/jobs")
res = client.get("/v1/launcher/jobs")
assert res.status_code == 200
assert [JobResultDTO.parse_obj(j) for j in res.json()] == [result.to_dto()]
service.get_jobs.assert_has_calls(
Expand Down
3 changes: 0 additions & 3 deletions tests/login/test_model.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import contextlib

from sqlalchemy.engine.base import Engine # type: ignore
from sqlalchemy.exc import IntegrityError # type: ignore
from sqlalchemy.orm import sessionmaker # type: ignore

from antarest.login.model import (
Expand Down
2 changes: 1 addition & 1 deletion tests/login/test_repository.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
from sqlalchemy.orm import Session, scoped_session, sessionmaker # type: ignore
from sqlalchemy.orm import Session # type: ignore

from antarest.login.model import Bot, Group, Password, Role, RoleType, User, UserLdap
from antarest.login.repository import BotRepository, GroupRepository, RoleRepository, UserLdapRepository, UserRepository
Expand Down
2 changes: 1 addition & 1 deletion tests/storage/business/test_variant_study_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def task_status(*args):
yield t

study_service.task_service.status_task.side_effect = task_status()
with pytest.raises(VariantGenerationError, match=f"Error while generating study2.py"):
with pytest.raises(VariantGenerationError, match="Error while generating study2.py"):
study_service.get(metadata=metadata, url=sub_route, depth=2)
study_service.task_service.await_task.assert_called()

Expand Down
2 changes: 1 addition & 1 deletion tests/storage/repository/filesystem/test_lazy_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def test_save_uri(tmp_path: Path):
context = ContextServer(matrix=Mock(), resolver=resolver)
node = MockLazyNode(context=context, config=config)

uri = f"matrix://id"
uri = "matrix://id"
node.save(uri)
assert (file.parent / f"{file.name}.link").read_text() == uri
assert not file.exists()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

import numpy as np
import pytest
from sqlalchemy import event # type: ignore

from antarest.core.exceptions import VariantGenerationError
from antarest.core.interfaces.cache import CacheConstants
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

import numpy as np
import pytest
from sqlalchemy import create_engine # type: ignore

from antarest.core.model import PublicMode
from antarest.core.requests import RequestParameters
Expand Down
6 changes: 3 additions & 3 deletions tests/variantstudy/model/command/test_create_cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,17 +247,17 @@ def test_create_diff(command_context: CommandContext):

assert base.create_diff(other_match) == [
ReplaceMatrix(
target=f"input/thermal/prepro/foo/foo/data",
target="input/thermal/prepro/foo/foo/data",
matrix=prepro_b,
command_context=command_context,
),
ReplaceMatrix(
target=f"input/thermal/prepro/foo/foo/modulation",
target="input/thermal/prepro/foo/foo/modulation",
matrix=modulation_b,
command_context=command_context,
),
UpdateConfig(
target=f"input/thermal/clusters/foo/list/foo",
target="input/thermal/clusters/foo/list/foo",
data={"nominalcapacity": "2400"},
command_context=command_context,
),
Expand Down
4 changes: 2 additions & 2 deletions tests/variantstudy/model/command/test_create_link.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,12 +254,12 @@ def test_create_diff(command_context: CommandContext):

assert base.create_diff(other_match) == [
UpdateConfig(
target=f"input/links/bar/properties/foo",
target="input/links/bar/properties/foo",
data=CreateLink.generate_link_properties({"hurdles-cost": "true"}),
command_context=command_context,
),
ReplaceMatrix(
target=f"@links_series/bar/foo",
target="@links_series/bar/foo",
matrix=series_b,
command_context=command_context,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ def test_create_diff(command_context: CommandContext):
)
assert base.create_diff(other_match) == [
UpdateConfig(
target=f"input/renewables/clusters/foo/list/foo",
target="input/renewables/clusters/foo/list/foo",
data={"a": "b"},
command_context=command_context,
),
Expand Down

0 comments on commit fce46c6

Please sign in to comment.