Skip to content

Commit

Permalink
sort before comparing (#1372)
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristopherChudzicki authored Aug 6, 2024
1 parent 69ea9a5 commit 9a18281
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions learning_resources_search/serializers_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -557,19 +557,19 @@ def test_serialize_bulk_learning_resources(mocker):
every existing learning resource
"""
# NOTE: explicitly creating a fixed number per type for a deterministic query count
resources = [
*factories.LearningResourceFactory.create_batch(5, is_course=True),
*factories.LearningResourceFactory.create_batch(5, is_program=True),
*factories.LearningResourceFactory.create_batch(5, is_podcast=True),
*factories.LearningResourceFactory.create_batch(5, is_podcast_episode=True),
*factories.LearningResourceFactory.create_batch(5, is_video=True),
*factories.LearningResourceFactory.create_batch(5, is_video_playlist=True),
]
resources = LearningResource.objects.for_serialization()
results = list(
factories.LearningResourceFactory.create_batch(5, is_course=True)
factories.LearningResourceFactory.create_batch(5, is_program=True)
factories.LearningResourceFactory.create_batch(5, is_podcast=True)
factories.LearningResourceFactory.create_batch(5, is_podcast_episode=True)
factories.LearningResourceFactory.create_batch(5, is_video=True)
factories.LearningResourceFactory.create_batch(5, is_video_playlist=True)

resources = LearningResource.objects.order_by("id").for_serialization()
results = sorted(
serializers.serialize_bulk_learning_resources(
[resource.id for resource in resources]
)
),
key=lambda x: x["id"],
)

expected = []
Expand Down

0 comments on commit 9a18281

Please sign in to comment.