<commit_before>from django import forms
from django.forms import ModelChoiceField
from django.forms.forms import BoundField
from django.test import TestCase
from jet.templatetags.jet_tags import select2_lookups
from jet.tests.models import TestModel, SearchableTestModel


class TagsTestCase(TestCase):
    models = []
    searchable_models = []

    def setUp(self):
        self.models.append(TestModel.objects.create(field1='first', field2=1))
        self.models.append(TestModel.objects.create(field1='second', field2=2))
        self.searchable_models.append(SearchableTestModel.objects.create(field1='first', field2=1))
        self.searchable_models.append(SearchableTestModel.objects.create(field1='second', field2=2))

    def test_select2_lookups(self):
        class TestForm(forms.Form):
            form_field = forms.ModelChoiceField(SearchableTestModel.objects)

        value = self.searchable_models[0]

        form = TestForm(initial={'form_field': value.pk})
        field = form['form_field']<commit_msg>Optimize import<commit_after>from django import forms
from django.test import TestCase
from jet.templatetags.jet_tags import select2_lookups
from jet.tests.models import TestModel, SearchableTestModel


class TagsTestCase(TestCase):
    models = []
    searchable_models = []

    def setUp(self):
        self.models.append(TestModel.objects.create(field1='first', field2=1))
        self.models.append(TestModel.objects.create(field1='second', field2=2))
        self.searchable_models.append(SearchableTestModel.objects.create(field1='first', field2=1))
        self.searchable_models.append(SearchableTestModel.objects.create(field1='second', field2=2))

    def test_select2_lookups(self):
        class TestForm(forms.Form):
            form_field = forms.ModelChoiceField(SearchableTestModel.objects)

        value = self.searchable_models[0]

        form = TestForm(initial={'form_field': value.pk})
        field = form['form_field']
{'fraction_non_alphanumeric': 0.10710659898477157, 'fraction_numerical': 0.015228426395939087, 'mean_word_length': 4.429752066115703, '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': '5287537', 'n_tokens_mistral': 586, 'n_tokens_neox': 575, 'n_words': 96}