# Path: tests/testapp/models.py
# class CharListDefaultModel(Model):
#     field = ListCharField(
#         base_field=CharField(max_length=5),
#         size=5,
#         max_length=32,
#         default=lambda: ["a", "d"],
#     )
# 
# class CharListModel(Model):
#     field = ListCharField(base_field=CharField(max_length=8), size=3, max_length=32)
# 
# class IntListModel(Model):
#     field = ListCharField(base_field=IntegerField(), size=5, max_length=32)


import json
import re
import pytest
from django import forms
from django.core import exceptions, serializers
from django.core.management import call_command
from django.db import connection, models
from django.db.migrations.writer import MigrationWriter
from django.db.models import Q, Value
from django.test import SimpleTestCase, TestCase, TransactionTestCase, override_settings
from django.test.utils import isolate_apps
from django_mysql.forms import SimpleListField
from django_mysql.models import ListCharField, ListF
from django_mysql.test.utils import override_mysql_variables
from tests.testapp.models import CharListDefaultModel, CharListModel, IntListModel

        red0_or_blue0 = CharListModel.objects.filter(
            Q(field__0="red") | Q(field__0="blue")
        )
        assert list(red0_or_blue0) == [mymodel]

    def test_char_position_lookup_repeat_fails(self):
        """
        FIND_IN_SET returns the *first* position so repeats are not dealt with
        """
        CharListModel.objects.create(field=["red", "red", "blue"])

        red1 = CharListModel.objects.filter(field__1="red")
        assert list(red1) == []  # should be 'red'

    def test_char_position_lookup_too_long(self):
        CharListModel.objects.create(field=["red", "blue"])

        red1 = CharListModel.objects.filter(field__2="blue")
        assert list(red1) == []

    def test_int_easy(self):
        mymodel = IntListModel.objects.create(field=[1, 2])
        assert mymodel.field == [1, 2]
        mymodel = IntListModel.objects.get(id=mymodel.id)
        assert mymodel.field == [1, 2]

    def test_int_contains_lookup(self):
        onetwo = IntListModel.objects.create(field=[1, 2])


# Path: tests/testapp/models.py
# class CharListDefaultModel(Model):
#     field = ListCharField(
#         base_field=CharField(max_length=5),
#         size=5,
#         max_length=32,
#         default=lambda: ["a", "d"],
#     )
# 
# class CharListModel(Model):
#     field = ListCharField(base_field=CharField(max_length=8), size=3, max_length=32)
# 
# class IntListModel(Model):
#     field = ListCharField(base_field=IntegerField(), size=5, max_length=32)


# Path: tests/testapp/test_listcharfield.py
import json
import re
import pytest
from django import forms
from django.core import exceptions, serializers
from django.core.management import call_command
from django.db import connection, models
from django.db.migrations.writer import MigrationWriter
from django.db.models import Q, Value
from django.test import SimpleTestCase, TestCase, TransactionTestCase, override_settings
from django.test.utils import isolate_apps
from django_mysql.forms import SimpleListField
from django_mysql.models import ListCharField, ListF
from django_mysql.test.utils import override_mysql_variables
from tests.testapp.models import CharListDefaultModel, CharListModel, IntListModel


        red0_or_blue0 = CharListModel.objects.filter(
            Q(field__0="red") | Q(field__0="blue")
        )
        assert list(red0_or_blue0) == [mymodel]

    def test_char_position_lookup_repeat_fails(self):
        """
        FIND_IN_SET returns the *first* position so repeats are not dealt with
        """
        CharListModel.objects.create(field=["red", "red", "blue"])

        red1 = CharListModel.objects.filter(field__1="red")
        assert list(red1) == []  # should be 'red'

    def test_char_position_lookup_too_long(self):
        CharListModel.objects.create(field=["red", "blue"])

        red1 = CharListModel.objects.filter(field__2="blue")
        assert list(red1) == []

    def test_int_easy(self):
        mymodel = IntListModel.objects.create(field=[1, 2])
        assert mymodel.field == [1, 2]
        mymodel = IntListModel.objects.get(id=mymodel.id)
        assert mymodel.field == [1, 2]

    def test_int_contains_lookup(self):
        onetwo = IntListModel.objects.create(field=[1, 2])


        ones = IntListModel.objects.filter(field__contains=1)