Skip to content

Commit 61ce9fa

Browse files
committed
Convert type comments to annotations
1 parent 398420a commit 61ce9fa

File tree

6 files changed

+8
-8
lines changed

6 files changed

+8
-8
lines changed

pytest_django/asserts.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def assertion_func(*args, **kwargs):
2626

2727

2828
__all__ = []
29-
assertions_names = set() # type: Set[str]
29+
assertions_names: Set[str] = set()
3030
assertions_names.update(
3131
{attr for attr in vars(TestCase) if attr.startswith("assert")},
3232
{attr for attr in vars(SimpleTestCase) if attr.startswith("assert")},

pytest_django/fixtures.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ def async_rf() -> "django.test.client.AsyncRequestFactory":
468468

469469

470470
class SettingsWrapper:
471-
_to_restore = [] # type: List[Any]
471+
_to_restore: List[Any] = []
472472

473473
def __delattr__(self, attr: str) -> None:
474474
from django.test import override_settings
@@ -630,7 +630,7 @@ def _capture_on_commit_callbacks(
630630

631631
# Polyfill of Django code as of Django 3.2.
632632
if get_django_version() < (3, 2):
633-
callbacks = [] # type: List[Callable[[], Any]]
633+
callbacks: List[Callable[[], Any]] = []
634634
start_count = len(connections[using].run_on_commit)
635635
try:
636636
yield callbacks

pytest_django/lazy_django.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def django_settings_is_configured() -> bool:
2424
ret = bool(os.environ.get("DJANGO_SETTINGS_MODULE"))
2525

2626
if not ret and "django.conf" in sys.modules:
27-
django_conf = sys.modules["django.conf"] # type: Any
27+
django_conf: Any = sys.modules["django.conf"]
2828
return django_conf.settings.configured
2929

3030
return ret

pytest_django/live_server_helper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def __init__(self, addr: str) -> None:
1313
from django.test.testcases import LiveServerThread
1414
from django.test.utils import modify_settings
1515

16-
liveserver_kwargs = {} # type: Dict[str, Any]
16+
liveserver_kwargs: Dict[str, Any] = {}
1717

1818
connections_override = {}
1919
for conn in connections.all():

pytest_django_test/app/migrations/0001_initial.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class Migration(migrations.Migration):
77

88
initial = True
99

10-
dependencies = [] # type: List[Tuple[str, str]]
10+
dependencies: List[Tuple[str, str]] = []
1111

1212
operations = [
1313
migrations.CreateModel(

pytest_django_test/app/models.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33

44
# Routed to database "main".
55
class Item(models.Model):
6-
name = models.CharField(max_length=100) # type: str
6+
name: str = models.CharField(max_length=100)
77

88

99
# Routed to database "second".
1010
class SecondItem(models.Model):
11-
name = models.CharField(max_length=100) # type: str
11+
name: str = models.CharField(max_length=100)

0 commit comments

Comments
 (0)