Skip to content

Commit 8a9ca96

Browse files
committed
Fixed and added more tests
1 parent ff0683c commit 8a9ca96

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

pylint_django/tests/input/func_queryset_hints.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99

1010
class Book(models.Model):
11-
name = models.CharField(max_length=100) # [consider-using-bulk-create]
11+
name = models.CharField(max_length=100)
1212

1313
class Meta:
1414
app_label = "test_app"
@@ -33,3 +33,9 @@ def assigned_for_create():
3333
def for_filter():
3434
for i in range(10):
3535
_ = Book.objects.filter(name=str(i)) # [consider-using-in-queries]
36+
37+
38+
def for_save():
39+
obj = Book(name="Test Book")
40+
for _ in range(10):
41+
obj.save() # [consider-using-bulk-create-save]
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
consider-using-bulk-create:19:8:19:40:for_create:Consider using 'Model.bulk_create()':UNDEFINED
22
consider-using-bulk-create:25:12:25:44:for_nested_if_create:Consider using 'Model.bulk_create()':UNDEFINED
3-
consider-using-bulk-create:30:12:30:49:assigned_for_create:Consider using 'Model.bulk_create()':UNDEFINED
4-
consider-using-in-queries:35:12:35:49:for_filter:Consider using 'Model.bulk_*():UNDEFINED
3+
consider-using-bulk-create:30:12:30:44:assigned_for_create:Consider using 'Model.bulk_create()':UNDEFINED
4+
consider-using-in-queries:35:12:35:44:for_filter:Consider using '__in' queries:UNDEFINED
5+
consider-using-bulk-create-save:41:8:41:18:for_save:Consider using 'Model.bulk_*():UNDEFINED

0 commit comments

Comments
 (0)