<commit_before>from django.test import TestCase
from django.db.models import Prefetch
from tests.models import A, B, C, D


class TestModels(TestCase):

    def testNestedPrefetch(self):
        a = A.objects.create(name="a")
        b = B.objects.create(a=a)
        d = D.objects.create(name="d")
        c = C.objects.create(b=b, a=a, d=d)

        a = A.objects.filter(pk=a.pk).prefetch_related(
            Prefetch(
                'b',
                queryset=B.objects.prefetch_related(
                    Prefetch(
                        'cs',
                        queryset=C.objects.prefetch_related(
                            Prefetch(
                                'd',
                                queryset=D.objects.all()
                            )
                        )
                    )
                )
            )
        )[0]<commit_msg>cleaned up test<commit_after>from django.test import TestCase
from django.db.models import Prefetch
from tests.models import A, B, C, D


class TestModels(TestCase):

    def testNestedPrefetch(self):
        a = A.objects.create(name="a")
        b = B.objects.create(a=a)
        d = D.objects.create(name="d")
        c = C.objects.create(b=b, d=d)

        # This fails
        A.objects.prefetch_related(
            Prefetch(
                'b',
                queryset=B.objects.prefetch_related(
                    Prefetch(
                        'cs',
                        queryset=C.objects.prefetch_related(
                            Prefetch(
                                'd',
                                queryset=D.objects.all()
                            )
                        )
                    )
                )
            )
        )[0]
{'fraction_non_alphanumeric': 0.09807256235827665, 'fraction_numerical': 0.0011337868480725624, 'mean_word_length': 1.0217640320733103, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7208692', 'n_tokens_mistral': 500, 'n_tokens_neox': 461, 'n_words': 83}