# Path: tests/testapp/models.py
# class EnumModel(Model):
# class NullableEnumModel(Model):
# class CharSetModel(Model):
# class CharListModel(Model):
# class IntSetModel(Model):
# class IntListModel(Model):
# class CharSetDefaultModel(Model):
# class CharListDefaultModel(Model):
# class BigCharSetModel(Model):
# class BigCharListModel(Model):
# class BigIntSetModel(Model):
# class BigIntListModel(Model):
# class DynamicModel(Model):
# class SpeclessDynamicModel(Model):
# class FixedCharModel(Model):
# class Author(Model):
# class Book(Model):
# class VanillaAuthor(VanillaModel):
# class AuthorExtra(Model):
# class NameAuthor(Model):
# class NameAuthorExtra(Model):
# class AuthorMultiIndex(Model):
#     class Meta:
# class AuthorHugeName(Model):
#     class Meta:
# class Alphabet(Model):
# class ProxyAlphabet(Alphabet):
#     class Meta:
# class Customer(Model):
# class AgedCustomer(Customer):
# class TitledAgedCustomer(AgedCustomer):
#     class Meta:
# class SizeFieldModel(Model):
# class Bit1Model(Model):
#     class NullBit1Model(Model):
# class JSONModel(Model):
# class ExpensiveCalculation:
# class Poll(VanillaModel):
#     def check(cls, **kwargs):
#     def __str__(self):  # pragma: no cover
#     def check(cls, **kwargs):
#     def __str__(self):  # pragma: no cover
#     def a_times_b(self):
#     def __str__(self):  # pragma: no cover
#     def __init__(self) -> None:
#     def __call__(self) -> dt.datetime:
#     def reset(self) -> None:
#     def call_count(self) -> int:


import os
import pickle
import time
import types
import pytest
from decimal import Decimal
from io import StringIO
from typing import Any
from django.core.cache import CacheKeyWarning, cache, caches
from django.core.management import CommandError, call_command
from django.db import IntegrityError, connection
from django.db.migrations.state import ProjectState
from django.http import HttpResponse
from django.middleware.cache import FetchFromCacheMiddleware, UpdateCacheMiddleware
from django.test import RequestFactory, TestCase, TransactionTestCase
from django.test.utils import override_settings
from parameterized import parameterized
from django_mysql.cache import BIGINT_SIGNED_MAX, BIGINT_SIGNED_MIN, MySQLCache
from tests.testapp.models import Poll, expensive_calculation
        from zlib import compress, decompress
        from django.core.cache.backends.db import Options
        from django_mysql.cache import Options as OurOptions
    def test_data_types(self):
        # Many different data types can be cached
        stuff = {
            "string": "this is a string",
            "int": 42,
            "list": [1, 2, 3, 4],
            "tuple": (1, 2, 3, 4),
            "dict": {"A": 1, "B": 2},
            "function": f,
            "class": C,
        }
        cache.set("stuff", stuff)
        assert cache.get("stuff") == stuff

    def test_cache_read_for_model_instance(self):
        # Don't want fields with callable as default to be called on cache read
        expensive_calculation.reset()
        Poll.objects.all().delete()
        my_poll = Poll.objects.create(question="Well?")
        assert Poll.objects.count() == 1
        pub_date = my_poll.pub_date
        cache.set("question", my_poll)
        cached_poll = cache.get("question")
        assert cached_poll.pub_date == pub_date
        # We only want the default expensive calculation run once
        assert expensive_calculation.call_count() == 1

    def test_cache_write_for_model_instance_with_deferred(self):
        # Don't want fields with callable as default to be called on cache
        # write

# Path: tests/testapp/models.py
# class EnumModel(Model):
# class NullableEnumModel(Model):
# class CharSetModel(Model):
# class CharListModel(Model):
# class IntSetModel(Model):
# class IntListModel(Model):
# class CharSetDefaultModel(Model):
# class CharListDefaultModel(Model):
# class BigCharSetModel(Model):
# class BigCharListModel(Model):
# class BigIntSetModel(Model):
# class BigIntListModel(Model):
# class DynamicModel(Model):
# class SpeclessDynamicModel(Model):
# class FixedCharModel(Model):
# class Author(Model):
# class Book(Model):
# class VanillaAuthor(VanillaModel):
# class AuthorExtra(Model):
# class NameAuthor(Model):
# class NameAuthorExtra(Model):
# class AuthorMultiIndex(Model):
#     class Meta:
# class AuthorHugeName(Model):
#     class Meta:
# class Alphabet(Model):
# class ProxyAlphabet(Alphabet):
#     class Meta:
# class Customer(Model):
# class AgedCustomer(Customer):
# class TitledAgedCustomer(AgedCustomer):
#     class Meta:
# class SizeFieldModel(Model):
# class Bit1Model(Model):
#     class NullBit1Model(Model):
# class JSONModel(Model):
# class ExpensiveCalculation:
# class Poll(VanillaModel):
#     def check(cls, **kwargs):
#     def __str__(self):  # pragma: no cover
#     def check(cls, **kwargs):
#     def __str__(self):  # pragma: no cover
#     def a_times_b(self):
#     def __str__(self):  # pragma: no cover
#     def __init__(self) -> None:
#     def __call__(self) -> dt.datetime:
#     def reset(self) -> None:
#     def call_count(self) -> int:


# Path: tests/testapp/test_cache.py
import os
import pickle
import time
import types
import pytest
from decimal import Decimal
from io import StringIO
from typing import Any
from django.core.cache import CacheKeyWarning, cache, caches
from django.core.management import CommandError, call_command
from django.db import IntegrityError, connection
from django.db.migrations.state import ProjectState
from django.http import HttpResponse
from django.middleware.cache import FetchFromCacheMiddleware, UpdateCacheMiddleware
from django.test import RequestFactory, TestCase, TransactionTestCase
from django.test.utils import override_settings
from parameterized import parameterized
from django_mysql.cache import BIGINT_SIGNED_MAX, BIGINT_SIGNED_MIN, MySQLCache
from tests.testapp.models import Poll, expensive_calculation
        from zlib import compress, decompress
        from django.core.cache.backends.db import Options
        from django_mysql.cache import Options as OurOptions

    def test_data_types(self):
        # Many different data types can be cached
        stuff = {
            "string": "this is a string",
            "int": 42,
            "list": [1, 2, 3, 4],
            "tuple": (1, 2, 3, 4),
            "dict": {"A": 1, "B": 2},
            "function": f,
            "class": C,
        }
        cache.set("stuff", stuff)
        assert cache.get("stuff") == stuff

    def test_cache_read_for_model_instance(self):
        # Don't want fields with callable as default to be called on cache read
        expensive_calculation.reset()
        Poll.objects.all().delete()
        my_poll = Poll.objects.create(question="Well?")
        assert Poll.objects.count() == 1
        pub_date = my_poll.pub_date
        cache.set("question", my_poll)
        cached_poll = cache.get("question")
        assert cached_poll.pub_date == pub_date
        # We only want the default expensive calculation run once
        assert expensive_calculation.call_count() == 1

    def test_cache_write_for_model_instance_with_deferred(self):
        # Don't want fields with callable as default to be called on cache
        # write

        expensive_calculation.reset()