          self.assertEqual({x.id for x in query}, {3})
  
          query = DumbCategory.objects.filter(
              id__in=DumbCategory.objects.order_by("-id")[2:]
          )[1:]
          self.assertEqual({x.id for x in query}, {2})
  
      def test_related_sliced_subquery(self):
          """
          Related objects constraints can safely contain sliced subqueries.
          refs #22434
 
</s> remove         )[0:2]
        self.assertEqual({x.id for x in query}, {3, 4})
 </s> add         ).order_by("id")[0:2]
        self.assertSequenceEqual([x.id for x in query], [3, 4]) </s> remove         )[1:3]
        self.assertEqual({x.id for x in query}, {3})
 </s> add         ).order_by("id")[1:3]
        self.assertSequenceEqual([x.id for x in query], [3])
        ).order_by("id")[1:]
        self.assertSequenceEqual([x.id for x in query], [2])
          self.assertEqual({x.id for x in query}, {3})
  
          query = DumbCategory.objects.filter(
              id__in=DumbCategory.objects.order_by("-id")[2:]
        ).order_by("id")[1:]
        self.assertSequenceEqual([x.id for x in query], [2])
        ).order_by("id")[1:]
        self.assertSequenceEqual([x.id for x in query], [2])
  
      def test_related_sliced_subquery(self):
          """
          Related objects constraints can safely contain sliced subqueries.
          refs #22434
keep keep keep keep replace replace keep keep keep keep keep
 Fixed non-deterministic order in SubqueryTests.test_slice_subquery_and_query.

Slice on unordered subquery may be non-deterministic in some databases. 
tests/queries/tests.py