aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMax Nanis2026-09-09 20:32:17 -0700
committerMax Nanis2026-09-09 20:32:17 -0700
commit832aecaddce80e312095ecdb572d7756eb9df5e9 (patch)
tree3f9b27bf285ef0648e22a1480ab213255d2cfee6 /tests
parente7e5b5f8bf81e78e417ecdb9dd6ab1616e722fa0 (diff)
downloadamt-jb-832aecaddce80e312095ecdb572d7756eb9df5e9.tar.gz
amt-jb-832aecaddce80e312095ecdb572d7756eb9df5e9.zip
Ruff auto fix, and requirements bump
Diffstat (limited to 'tests')
-rw-r--r--tests/__init__.py8
-rw-r--r--tests/conftest.py10
-rw-r--r--tests/fixtures/amt.py11
-rw-r--r--tests/fixtures/flow.py39
-rw-r--r--tests/fixtures/http.py21
-rw-r--r--tests/fixtures/managers.py8
-rw-r--r--tests/fixtures/models.py66
-rw-r--r--tests/flow/test_tasks.py52
-rw-r--r--tests/http/test_auth.py4
-rw-r--r--tests/http/test_notifications.py11
-rw-r--r--tests/http/test_preview.py3
-rw-r--r--tests/http/test_work.py4
-rw-r--r--tests/managers/test_amt.py9
-rw-r--r--tests/managers/test_hit.py4
-rw-r--r--tests/models/test_assignment.py3
-rw-r--r--tests/models/test_event.py1
-rw-r--r--tests/models/test_hit.py1
17 files changed, 128 insertions, 127 deletions
diff --git a/tests/__init__.py b/tests/__init__.py
index e60faf0..0166072 100644
--- a/tests/__init__.py
+++ b/tests/__init__.py
@@ -1,7 +1,7 @@
-import random
-import string
+from random import choices as rand_choices
+from string import ascii_uppercase, digits
def generate_amt_id(length: int = 30) -> str:
- chars = string.ascii_uppercase + string.digits
- return "".join(random.choices(chars, k=length))
+ chars = ascii_uppercase + digits
+ return "".join(rand_choices(chars, k=length))
diff --git a/tests/conftest.py b/tests/conftest.py
index c056821..2a3a580 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -1,14 +1,16 @@
import os
from typing import TYPE_CHECKING
from uuid import uuid4
-from dotenv import load_dotenv
+
import pytest
-from generalresearch.pg_helper import PostgresConfig
-from tests import generate_amt_id
from _pytest.config import Config
-from jb.decorators import CLIENT_CONFIG
+from dotenv import load_dotenv
+from generalresearch.pg_helper import PostgresConfig
from mypy_boto3_mturk import MTurkClient
+from jb.decorators import CLIENT_CONFIG
+from tests import generate_amt_id
+
if TYPE_CHECKING:
from jb.settings import Settings
diff --git a/tests/fixtures/amt.py b/tests/fixtures/amt.py
index 65df125..d7cc03d 100644
--- a/tests/fixtures/amt.py
+++ b/tests/fixtures/amt.py
@@ -1,17 +1,18 @@
-import pytest
import copy
-
+from collections.abc import Callable
from datetime import datetime, timedelta
-from typing import Callable
from uuid import uuid4
+
+import pytest
from dateutil.tz import tzlocal
from mypy_boto3_mturk.type_defs import (
- GetHITResponseTypeDef,
CreateHITTypeResponseTypeDef,
- ResponseMetadataTypeDef,
CreateHITWithHITTypeResponseTypeDef,
GetAssignmentResponseTypeDef,
+ GetHITResponseTypeDef,
+ ResponseMetadataTypeDef,
)
+
from jb.managers.amt import APPROVAL_MESSAGE, NO_WORK_APPROVAL_MESSAGE
from tests import generate_amt_id
diff --git a/tests/fixtures/flow.py b/tests/fixtures/flow.py
index 3fcca81..7bf8b4f 100644
--- a/tests/fixtures/flow.py
+++ b/tests/fixtures/flow.py
@@ -1,18 +1,21 @@
-from datetime import timezone, datetime
-from typing import Dict, Callable, Any, Optional
+from collections.abc import Callable
+from datetime import datetime, timezone
+from typing import Any
from uuid import uuid4
import pytest
import requests
+from generalresearch.currency import USDCent
+from generalresearch.models.thl.definitions import PayoutStatus
from generalresearch.models.thl.payout import UserPayoutEvent
-from generalresearch.models.thl.wallet.definitions import PayoutType
from generalresearch.models.thl.wallet.cashout_method import (
- CashoutRequestResponse,
CashoutRequestInfo,
+ CashoutRequestResponse,
)
+from generalresearch.models.thl.wallet.definitions import PayoutType
from mypy_boto3_mturk.type_defs import (
- GetHITResponseTypeDef,
GetAssignmentResponseTypeDef,
+ GetHITResponseTypeDef,
)
from jb.config import settings
@@ -20,8 +23,6 @@ from jb.managers.amt import (
APPROVAL_MESSAGE,
BONUS_MESSAGE,
)
-from generalresearch.currency import USDCent
-from generalresearch.models.thl.definitions import PayoutStatus
@pytest.fixture
@@ -31,16 +32,16 @@ def approved_assignment_stubs(
amt_assignment_id: str,
amt_hit_id: str,
hit_response_reviewing: GetHITResponseTypeDef,
-) -> Callable[..., list[Dict[str, Any]]]:
+) -> Callable[..., list[dict[str, Any]]]:
# These are the AMT_CLIENT stubs/mocks that need to be set when running
# process_assignment_submitted() which will result in an approved
# assignment and sent bonus
def _inner(
feedback: str = APPROVAL_MESSAGE,
- override_response: Optional[str] = None,
- override_approve_response: Optional[str] = None,
- ) -> list[Dict[str, Any]]:
+ override_response: str | None = None,
+ override_approve_response: str | None = None,
+ ) -> list[dict[str, Any]]:
response = override_response or assignment_response
approve_response = (
@@ -84,11 +85,11 @@ def approved_assignment_stubs(
@pytest.fixture
def approved_assignment_stubs_w_bonus(
- approved_assignment_stubs: Callable[..., list[Dict[str, Any]]],
+ approved_assignment_stubs: Callable[..., list[dict[str, Any]]],
amt_worker_id: str,
amt_assignment_id: str,
pe_id: str,
-) -> list[Dict[str, Any]]:
+) -> list[dict[str, Any]]:
now = datetime.now(tz=timezone.utc)
stubs = approved_assignment_stubs().copy()
@@ -132,16 +133,16 @@ def rejected_assignment_stubs(
amt_assignment_id: str,
amt_hit_id: str,
hit_response_reviewing: GetHITResponseTypeDef,
-) -> Callable[..., list[Dict[str, Any]]]:
+) -> Callable[..., list[dict[str, Any]]]:
# These are the AMT_CLIENT stubs/mocks that need to be set when running
# process_assignment_submitted() which will result in a rejected
# assignment
def _inner(
reject_reason: str,
- override_response: Optional[str] = None,
- override_reject_response: Optional[str] = None,
- ) -> list[Dict[str, Any]]:
+ override_response: str | None = None,
+ override_reject_response: str | None = None,
+ ) -> list[dict[str, Any]]:
response = override_response or assignment_response
reject_response = (
@@ -233,7 +234,7 @@ def mock_thl_responses(
elif url == wallet_url:
class MockThlWalletResponse:
- def json(self) -> Dict[str, Any]:
+ def json(self) -> dict[str, Any]:
return {
"wallet": {
"amount": wallet_redeemable_amount,
@@ -246,7 +247,7 @@ def mock_thl_responses(
elif url == status_url:
class MockThlStatusResponse:
- def json(self) -> Dict[str, Any]:
+ def json(self) -> dict[str, Any]:
return {
"tsid": tsid,
"product_id": str(settings.product_id),
diff --git a/tests/fixtures/http.py b/tests/fixtures/http.py
index 5f50580..4b0792c 100644
--- a/tests/fixtures/http.py
+++ b/tests/fixtures/http.py
@@ -1,20 +1,19 @@
+import json
+import secrets
+from collections.abc import AsyncGenerator
+from typing import Any
+
import httpx
-import redis
import pytest
+import redis
import requests_mock
from asgi_lifespan import LifespanManager
-from httpx import AsyncClient, ASGITransport
-from typing import Dict, Any, AsyncGenerator
+from httpx import ASGITransport, AsyncClient
+from jb.config import JB_EVENTS_STREAM, settings
from jb.main import app
-import json
-
-from httpx import AsyncClient
-import secrets
-
-from jb.models.hit import Hit
from jb.models.assignment import AssignmentStub
-from jb.config import JB_EVENTS_STREAM, settings
+from jb.models.hit import Hit
from tests import generate_amt_id
@@ -69,7 +68,7 @@ def generate_hex_id(length: int = 40) -> str:
@pytest.fixture
def mturk_event_body_record(
hit_record: Hit, assignment_stub_record: AssignmentStub
-) -> Dict[str, Any]:
+) -> dict[str, Any]:
return {
"Type": "Notification",
"Message": json.dumps(
diff --git a/tests/fixtures/managers.py b/tests/fixtures/managers.py
index d10b542..22eae5e 100644
--- a/tests/fixtures/managers.py
+++ b/tests/fixtures/managers.py
@@ -1,14 +1,16 @@
from typing import TYPE_CHECKING
+
import pytest
-from jb.managers import Permission
from generalresearch.pg_helper import PostgresConfig
from mypy_boto3_mturk import MTurkClient
+from jb.managers import Permission
+
if TYPE_CHECKING:
- from jb.managers.hit import HitQuestionManager, HitTypeManager, HitManager
+ from jb.managers.amt import AMTManager
from jb.managers.assignment import AssignmentManager
from jb.managers.bonus import BonusManager
- from jb.managers.amt import AMTManager
+ from jb.managers.hit import HitManager, HitQuestionManager, HitTypeManager
# --- Managers ---
diff --git a/tests/fixtures/models.py b/tests/fixtures/models.py
index b818caa..157daec 100644
--- a/tests/fixtures/models.py
+++ b/tests/fixtures/models.py
@@ -1,23 +1,22 @@
-from datetime import timezone, datetime
+from collections.abc import Callable, Generator
+from datetime import datetime, timedelta, timezone
+from typing import TYPE_CHECKING
import pytest
-
-from jb.models.event import MTurkEvent
+from generalresearch.currency import USDCent
from generalresearch.pg_helper import PostgresConfig
+from psycopg.errors import ForeignKeyViolation
-from datetime import datetime, timezone, timedelta
-from typing import Optional, TYPE_CHECKING, Callable, Generator
from jb.managers.amt import AMTManager
-from jb.models.assignment import AssignmentStub, Assignment
-from generalresearch.currency import USDCent
-from jb.models.definitions import HitStatus, HitReviewStatus, AssignmentStatus
-from jb.models.hit import HitType, HitQuestion, Hit
+from jb.models.assignment import Assignment, AssignmentStub
+from jb.models.definitions import AssignmentStatus, HitReviewStatus, HitStatus
+from jb.models.event import MTurkEvent
+from jb.models.hit import Hit, HitQuestion, HitType
from tests import generate_amt_id
-from psycopg.errors import ForeignKeyViolation
if TYPE_CHECKING:
- from jb.managers.hit import HitQuestionManager, HitTypeManager, HitManager
from jb.managers.assignment import AssignmentManager
+ from jb.managers.hit import HitManager, HitQuestionManager, HitTypeManager
# --- MTurk Event ---
@@ -76,10 +75,9 @@ def hit_type_record(
yield ht
try:
- with pg_config.make_connection() as conn:
- with conn.cursor() as c:
- c.execute("DELETE FROM mtwerk_hittype WHERE id=%s", (ht.id,))
- conn.commit()
+ with pg_config.make_connection() as conn, conn.cursor() as c:
+ c.execute("DELETE FROM mtwerk_hittype WHERE id=%s", (ht.id,))
+ conn.commit()
except ForeignKeyViolation:
pass # DB gets dropped anyway, don't care
@@ -99,10 +97,9 @@ def hit_type_record_with_amt_id(
yield ht
try:
- with pg_config.make_connection() as conn:
- with conn.cursor() as c:
- c.execute("DELETE FROM mtwerk_hittype WHERE id=%s", (ht.id,))
- conn.commit()
+ with pg_config.make_connection() as conn, conn.cursor() as c:
+ c.execute("DELETE FROM mtwerk_hittype WHERE id=%s", (ht.id,))
+ conn.commit()
except ForeignKeyViolation:
pass # DB gets dropped anyway, don't care
@@ -166,10 +163,9 @@ def hit_record(
yield hit
try:
- with pg_config.make_connection() as conn:
- with conn.cursor() as c:
- c.execute("DELETE FROM mtwerk_hit WHERE id=%s", (hit.id,))
- conn.commit()
+ with pg_config.make_connection() as conn, conn.cursor() as c:
+ c.execute("DELETE FROM mtwerk_hit WHERE id=%s", (hit.id,))
+ conn.commit()
except ForeignKeyViolation:
pass # DB gets dropped anyway, don't care
@@ -228,12 +224,11 @@ def assignment_stub_record(
yield assignment_stub
try:
- with pg_config.make_connection() as conn:
- with conn.cursor() as c:
- c.execute(
- "DELETE FROM mtwerk_assignment WHERE id=%s", (assignment_stub.id,)
- )
- conn.commit()
+ with pg_config.make_connection() as conn, conn.cursor() as c:
+ c.execute(
+ "DELETE FROM mtwerk_assignment WHERE id=%s", (assignment_stub.id,)
+ )
+ conn.commit()
except ForeignKeyViolation:
pass # DB gets dropped anyway, don't care
@@ -255,19 +250,18 @@ def assignment_record(
yield assignment
try:
- with pg_config.make_connection() as conn:
- with conn.cursor() as c:
- c.execute("DELETE FROM mtwerk_assignment WHERE id=%s", (assignment.id,))
- conn.commit()
+ with pg_config.make_connection() as conn, conn.cursor() as c:
+ c.execute("DELETE FROM mtwerk_assignment WHERE id=%s", (assignment.id,))
+ conn.commit()
except ForeignKeyViolation:
pass # DB gets dropped anyway, don't care
@pytest.fixture
-def assignment_factory(hit_record: Hit) -> Callable[[Optional[str]], Assignment]:
+def assignment_factory(hit_record: Hit) -> Callable[[str | None], Assignment]:
- def _inner(amt_worker_id: Optional[str] = None) -> Assignment:
+ def _inner(amt_worker_id: str | None = None) -> Assignment:
now = datetime.now(tz=timezone.utc)
amt_assignment_id = generate_amt_id()
amt_worker_id = amt_worker_id or generate_amt_id()
@@ -292,7 +286,7 @@ def assignment_record_factory(
am: "AssignmentManager", assignment_factory: Callable[..., Assignment]
) -> Callable[..., Assignment]:
- def _inner(hit_id: int, amt_worker_id: Optional[str] = None) -> Assignment:
+ def _inner(hit_id: int, amt_worker_id: str | None = None) -> Assignment:
a = assignment_factory(amt_worker_id=amt_worker_id)
a.hit_id = hit_id
am.create_stub(a)
diff --git a/tests/flow/test_tasks.py b/tests/flow/test_tasks.py
index f939d20..9cc111f 100644
--- a/tests/flow/test_tasks.py
+++ b/tests/flow/test_tasks.py
@@ -1,34 +1,36 @@
import logging
+from collections.abc import Callable
from contextlib import contextmanager
-from typing import Callable, Dict, Any
+from typing import Any
import pytest
from botocore.stub import Stubber
+from generalresearch.currency import USDCent
+from mypy_boto3_mturk import MTurkClient
+from mypy_boto3_mturk.type_defs import (
+ GetAssignmentResponseTypeDef,
+)
+
from jb.flow.assignment_tasks import process_assignment_submitted
from jb.managers.amt import (
- AMTManager,
APPROVAL_MESSAGE,
+ NO_WORK_APPROVAL_MESSAGE,
REJECT_MESSAGE_BADDIE,
- REJECT_MESSAGE_UNKNOWN_ASSIGNMENT,
REJECT_MESSAGE_NO_WORK,
- NO_WORK_APPROVAL_MESSAGE,
-)
-from mypy_boto3_mturk.type_defs import (
- GetAssignmentResponseTypeDef,
+ REJECT_MESSAGE_UNKNOWN_ASSIGNMENT,
+ AMTManager,
)
-from generalresearch.currency import USDCent
from jb.managers.assignment import AssignmentManager
from jb.managers.bonus import BonusManager
from jb.managers.hit import HitManager
+from jb.models.assignment import Assignment, AssignmentStub
from jb.models.definitions import AssignmentStatus
from jb.models.event import MTurkEvent
from jb.models.hit import Hit
-from jb.models.assignment import Assignment, AssignmentStub
-from mypy_boto3_mturk import MTurkClient
@contextmanager
-def amt_stub_context(amt_client: MTurkClient, responses: list[Dict[str, Any]]):
+def amt_stub_context(amt_client: MTurkClient, responses: list[dict[str, Any]]):
# ty chatgpt for this
with Stubber(amt_client) as stub:
@@ -83,7 +85,7 @@ class TestProcessAssignmentSubmitted:
mturk_event: MTurkEvent,
amt_assignment_id: str,
caplog: pytest.LogCaptureFixture,
- rejected_assignment_stubs: Callable[..., list[Dict[str, Any]]],
+ rejected_assignment_stubs: Callable[..., list[dict[str, Any]]],
):
# These records are auto cleaned up, so we need to explicitly create
@@ -108,8 +110,8 @@ class TestProcessAssignmentSubmitted:
stub.assert_no_pending_responses()
assert f"No assignment found in DB: {amt_assignment_id}" in caplog.text
- assert f"Rejected assignment doesn't exist in DB. Creating ... " in caplog.text
- assert f"Rejected assignment: " in caplog.text
+ assert "Rejected assignment doesn't exist in DB. Creating ... " in caplog.text
+ assert "Rejected assignment: " in caplog.text
stub.assert_no_pending_responses()
ass = am.get(amt_assignment_id=amt_assignment_id)
@@ -128,7 +130,7 @@ class TestProcessAssignmentSubmitted:
assignment_stub_record: AssignmentStub,
caplog: pytest.LogCaptureFixture,
mock_thl_responses: Callable[..., None],
- rejected_assignment_stubs: Callable[..., list[Dict[str, Any]]],
+ rejected_assignment_stubs: Callable[..., list[dict[str, Any]]],
):
# An assignment is submitted. The hit and AssignmentStub exist in the
# DB. We think we're going to approve the Assignment, but the
@@ -152,8 +154,8 @@ class TestProcessAssignmentSubmitted:
stub.assert_no_pending_responses()
assert f"No assignment found in DB: {amt_assignment_id}" not in caplog.text
- assert f"blocked or not exists" in caplog.text
- assert f"Rejected assignment: " in caplog.text
+ assert "blocked or not exists" in caplog.text
+ assert "Rejected assignment: " in caplog.text
ass = am.get(amt_assignment_id=amt_assignment_id)
assert ass.status == AssignmentStatus.Rejected
@@ -171,7 +173,7 @@ class TestProcessAssignmentSubmitted:
assignment_stub_record: AssignmentStub,
caplog: pytest.LogCaptureFixture,
mock_thl_responses: Callable[..., None],
- approved_assignment_stubs: Callable[..., list[Dict[str, Any]]],
+ approved_assignment_stubs: Callable[..., list[dict[str, Any]]],
assignment_response_approved_no_tsid: GetAssignmentResponseTypeDef,
assignment_response_no_tsid: GetAssignmentResponseTypeDef,
):
@@ -202,8 +204,8 @@ class TestProcessAssignmentSubmitted:
stub.assert_no_pending_responses()
assert f"No assignment found in DB: {amt_assignment_id}" not in caplog.text
- assert f"Assignment submitted with no tsid" in caplog.text
- assert f"Approved assignment: " in caplog.text
+ assert "Assignment submitted with no tsid" in caplog.text
+ assert "Approved assignment: " in caplog.text
ass = am.get(amt_assignment_id=amt_assignment_id)
assert ass.status == AssignmentStatus.Approved
@@ -222,7 +224,7 @@ class TestProcessAssignmentSubmitted:
assignment_stub_record: AssignmentStub,
caplog: pytest.LogCaptureFixture,
mock_thl_responses: Callable[..., None],
- rejected_assignment_stubs: Callable[..., list[Dict[str, Any]]],
+ rejected_assignment_stubs: Callable[..., list[dict[str, Any]]],
assignment_response_factory_rejected_no_tsid: Callable[
..., GetAssignmentResponseTypeDef
],
@@ -273,8 +275,8 @@ class TestProcessAssignmentSubmitted:
stub.assert_no_pending_responses()
assert f"No assignment found in DB: {amt_assignment_id}" not in caplog.text
- assert f"Assignment submitted with no tsid" in caplog.text
- assert f"Rejected assignment: " in caplog.text
+ assert "Assignment submitted with no tsid" in caplog.text
+ assert "Rejected assignment: " in caplog.text
# It will exist in the db since we can validate the model.
ass = am.get(amt_assignment_id=amt_assignment_id)
@@ -293,7 +295,7 @@ class TestProcessAssignmentSubmitted:
assignment_stub_record: Assignment,
caplog: pytest.LogCaptureFixture,
mock_thl_responses: Callable[..., None],
- approved_assignment_stubs: Callable[..., list[Dict[str, Any]]],
+ approved_assignment_stubs: Callable[..., list[dict[str, Any]]],
):
_ = assignment_stub_record # we need this to make the assignment stub in the db
@@ -330,7 +332,7 @@ class TestProcessAssignmentSubmitted:
assignment_stub_record: Assignment,
caplog: pytest.LogCaptureFixture,
mock_thl_responses: Callable[..., None],
- approved_assignment_stubs_w_bonus: list[Dict[str, Any]],
+ approved_assignment_stubs_w_bonus: list[dict[str, Any]],
):
_ = assignment_stub_record # we need this to make the assignment stub in the db
mock_thl_responses(status_complete=True, wallet_redeemable_amount=10)
diff --git a/tests/http/test_auth.py b/tests/http/test_auth.py
index 02ac88a..ebda742 100644
--- a/tests/http/test_auth.py
+++ b/tests/http/test_auth.py
@@ -60,9 +60,7 @@ class TestAuth:
):
client = httpxclient
- res = await client.post(
- "/auth/magic-link/request", json={"email": email}
- )
+ res = await client.post("/auth/magic-link/request", json={"email": email})
d = res.json()
assert res.status_code == 200
assert d["magic_link"]
diff --git a/tests/http/test_notifications.py b/tests/http/test_notifications.py
index 508b236..60b94e6 100644
--- a/tests/http/test_notifications.py
+++ b/tests/http/test_notifications.py
@@ -1,14 +1,15 @@
-import pytest
import json
+from typing import Any
+from uuid import uuid4
+
+import pytest
import redis
-from typing import Dict, Any
from httpx import AsyncClient
-from uuid import uuid4
from jb.config import JB_EVENTS_STREAM, settings
+from jb.models.assignment import AssignmentStub
from jb.models.event import MTurkEvent
from jb.models.hit import Hit
-from jb.models.assignment import AssignmentStub
class TestNotifications:
@@ -55,7 +56,7 @@ class TestNotifications:
httpxclient: AsyncClient,
hit_record: Hit,
assignment_stub_record: AssignmentStub,
- mturk_event_body_record: Dict[str, Any],
+ mturk_event_body_record: dict[str, Any],
):
client = httpxclient
diff --git a/tests/http/test_preview.py b/tests/http/test_preview.py
index 467c63c..39a6f5b 100644
--- a/tests/http/test_preview.py
+++ b/tests/http/test_preview.py
@@ -3,8 +3,9 @@
import pytest
from httpx import AsyncClient
-from jb.models.hit import Hit
+
from jb.models.assignment import AssignmentStub
+from jb.models.hit import Hit
class TestPreview:
diff --git a/tests/http/test_work.py b/tests/http/test_work.py
index 66251f6..7f10b46 100644
--- a/tests/http/test_work.py
+++ b/tests/http/test_work.py
@@ -1,9 +1,9 @@
import pytest
from httpx import AsyncClient
-from jb.models.hit import Hit
-from jb.models.assignment import AssignmentStub
from jb.managers.assignment import AssignmentManager
+from jb.models.assignment import AssignmentStub
+from jb.models.hit import Hit
class TestWork:
diff --git a/tests/managers/test_amt.py b/tests/managers/test_amt.py
index a20d0d4..6a944a8 100644
--- a/tests/managers/test_amt.py
+++ b/tests/managers/test_amt.py
@@ -1,14 +1,13 @@
-from jb.managers.amt import AMTManager
-from jb.models.hit import HitType, HitQuestion
-
-from jb.managers.hit import HitQuestionManager, HitTypeManager, HitManager
from mypy_boto3_mturk import MTurkClient
from mypy_boto3_mturk.type_defs import (
- GetAssignmentResponseTypeDef,
GetAccountBalanceResponseTypeDef,
ListHITsResponseTypeDef,
)
+from jb.managers.amt import AMTManager
+from jb.managers.hit import HitManager, HitTypeManager
+from jb.models.hit import HitQuestion, HitType
+
# from jb.decorators import HM
# from jb.flow.tasks import refill_hits, check_stale_hits, check_expired_hits
diff --git a/tests/managers/test_hit.py b/tests/managers/test_hit.py
index 974bd18..7227e4d 100644
--- a/tests/managers/test_hit.py
+++ b/tests/managers/test_hit.py
@@ -1,5 +1,5 @@
-from jb.models.hit import HitQuestion, HitType, Hit
-from jb.managers.hit import HitTypeManager, HitManager
+from jb.managers.hit import HitManager, HitTypeManager
+from jb.models.hit import Hit, HitQuestion, HitType
class TestHitQuestionManager:
diff --git a/tests/models/test_assignment.py b/tests/models/test_assignment.py
index 2a87364..ecaafe9 100644
--- a/tests/models/test_assignment.py
+++ b/tests/models/test_assignment.py
@@ -1,8 +1,9 @@
-from jb.models.assignment import Assignment, AssignmentStub
from mypy_boto3_mturk.type_defs import (
GetAssignmentResponseTypeDef,
)
+from jb.models.assignment import Assignment, AssignmentStub
+
class TestAssignmentStub:
diff --git a/tests/models/test_event.py b/tests/models/test_event.py
index 0496574..a4c591d 100644
--- a/tests/models/test_event.py
+++ b/tests/models/test_event.py
@@ -1,6 +1,5 @@
import pytest
-
from jb.models.event import MTurkEvent
diff --git a/tests/models/test_hit.py b/tests/models/test_hit.py
index 3952068..aa48f00 100644
--- a/tests/models/test_hit.py
+++ b/tests/models/test_hit.py
@@ -1,4 +1,5 @@
import pytest
+
from jb.models.hit import Hit