Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
a_bondar committed Apr 23, 2024
1 parent 2c51ca6 commit 0cccecc
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions tests/test_bulk.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,22 @@ async def test_bulk_create_mix_specified(self):
all_ = await UniqueName.all().order_by("id").values("id", "name")
self.assertEqual(len(all_), 2000)

self.assertListSortEqual(
all_[1000:], [{"id": id_, "name": None} for id_ in range(10000, 11000)], sorted_key="id"
)
inc = all_[0]["id"]
self.assertListSortEqual(
all_[:1000], [{"id": val + inc, "name": None} for val in range(1000)], sorted_key="id"
)
if all_[0]["id"] == 10000:
self.assertListSortEqual(
all_[:1000], [{"id": id_, "name": None} for id_ in range(10000, 11000)], sorted_key="id"
)
inc = all_[1000]["id"]
self.assertListSortEqual(
all_[1000:], [{"id": val + inc, "name": None} for val in range(1000)], sorted_key="id"
)
else:
inc = all_[0]["id"]
self.assertListSortEqual(
all_[:1000], [{"id": val + inc, "name": None} for val in range(1000)], sorted_key="id"
)
self.assertListSortEqual(
all_[1000:], [{"id": id_, "name": None} for id_ in range(10000, 11000)], sorted_key="id"
)

async def test_bulk_create_uuidpk(self):
await UUIDPkModel.bulk_create([UUIDPkModel() for _ in range(1000)])
Expand Down

0 comments on commit 0cccecc

Please sign in to comment.