# Path: tests/testapp/models.py
# class BigCharListModel(Model):
#     field = ListTextField(base_field=CharField(max_length=8))
# 
# class BigIntListModel(Model):
#     field = ListTextField(base_field=IntegerField())


import json
import re
import pytest
from django import forms
from django.core import exceptions, serializers
from django.db import models
from django.db.migrations.writer import MigrationWriter
from django.db.models import Q
from django.test import SimpleTestCase, TestCase
from django.test.utils import isolate_apps
from django_mysql.forms import SimpleListField
from django_mysql.models import ListTextField
from tests.testapp.models import BigCharListModel, BigIntListModel
        from django_mysql.models.fields import ListTextField as LTField
        from django_mysql.models.fields.lists import ListTextField as LTField
        not_mouldy = BigCharListModel.objects.exclude(**{lname: "mouldy"})
        assert not_mouldy.count() == 0

    def test_char_len_lookup_empty(self):
        mymodel = BigCharListModel.objects.create(field=[])

        empty = BigCharListModel.objects.filter(field__len=0)
        assert empty.count() == 1
        assert empty[0] == mymodel

        one = BigCharListModel.objects.filter(field__len=1)
        assert one.count() == 0

        one_or_more = BigCharListModel.objects.filter(field__len__gte=0)
        assert one_or_more.count() == 1

    def test_char_len_lookup(self):
        mymodel = BigCharListModel.objects.create(field=["red", "expensive"])

        empty = BigCharListModel.objects.filter(field__len=0)
        assert empty.count() == 0

        one_or_more = BigCharListModel.objects.filter(field__len__gte=1)
        assert one_or_more.count() == 1
        assert one_or_more[0] == mymodel

        two = BigCharListModel.objects.filter(field__len=2)
        assert two.count() == 1
        assert two[0] == mymodel


# Path: tests/testapp/models.py
# class BigCharListModel(Model):
#     field = ListTextField(base_field=CharField(max_length=8))
# 
# class BigIntListModel(Model):
#     field = ListTextField(base_field=IntegerField())


# Path: tests/testapp/test_listtextfield.py
import json
import re
import pytest
from django import forms
from django.core import exceptions, serializers
from django.db import models
from django.db.migrations.writer import MigrationWriter
from django.db.models import Q
from django.test import SimpleTestCase, TestCase
from django.test.utils import isolate_apps
from django_mysql.forms import SimpleListField
from django_mysql.models import ListTextField
from tests.testapp.models import BigCharListModel, BigIntListModel
        from django_mysql.models.fields import ListTextField as LTField
        from django_mysql.models.fields.lists import ListTextField as LTField

        not_mouldy = BigCharListModel.objects.exclude(**{lname: "mouldy"})
        assert not_mouldy.count() == 0

    def test_char_len_lookup_empty(self):
        mymodel = BigCharListModel.objects.create(field=[])

        empty = BigCharListModel.objects.filter(field__len=0)
        assert empty.count() == 1
        assert empty[0] == mymodel

        one = BigCharListModel.objects.filter(field__len=1)
        assert one.count() == 0

        one_or_more = BigCharListModel.objects.filter(field__len__gte=0)
        assert one_or_more.count() == 1

    def test_char_len_lookup(self):
        mymodel = BigCharListModel.objects.create(field=["red", "expensive"])

        empty = BigCharListModel.objects.filter(field__len=0)
        assert empty.count() == 0

        one_or_more = BigCharListModel.objects.filter(field__len__gte=1)
        assert one_or_more.count() == 1
        assert one_or_more[0] == mymodel

        two = BigCharListModel.objects.filter(field__len=2)
        assert two.count() == 1
        assert two[0] == mymodel


        three = BigCharListModel.objects.filter(field__len=3)