Refs #33646 -- Moved tests of QuerySet async interface into async tests.

This commit is contained in:
Bhuvnesh 2022-11-04 00:41:19 +05:30 committed by GitHub
parent 3dc9f3ac69
commit e580b891cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 12 deletions

View File

@ -1,5 +1,11 @@
from django.db import models from django.db import models
from django.utils import timezone
class RelatedModel(models.Model):
simple = models.ForeignKey("SimpleModel", models.CASCADE, null=True)
class SimpleModel(models.Model): class SimpleModel(models.Model):
field = models.IntegerField() field = models.IntegerField()
created = models.DateTimeField(default=timezone.now)

View File

@ -243,6 +243,6 @@ class AsyncQuerySetTest(TestCase):
self.fail(f"QuerySet.aexplain() result is not valid JSON: {e}") self.fail(f"QuerySet.aexplain() result is not valid JSON: {e}")
async def test_raw(self): async def test_raw(self):
sql = "SELECT id, field FROM async_queryset_simplemodel WHERE created=%s" sql = "SELECT id, field FROM async_simplemodel WHERE created=%s"
qs = SimpleModel.objects.raw(sql, [self.s1.created]) qs = SimpleModel.objects.raw(sql, [self.s1.created])
self.assertEqual([o async for o in qs], [self.s1]) self.assertEqual([o async for o in qs], [self.s1])

View File

@ -1,11 +0,0 @@
from django.db import models
from django.utils import timezone
class RelatedModel(models.Model):
simple = models.ForeignKey("SimpleModel", models.CASCADE, null=True)
class SimpleModel(models.Model):
field = models.IntegerField()
created = models.DateTimeField(default=timezone.now)