<commit_before># -*- coding: utf-8 -*-
import pytest
import django
from django.db import migrations, models
from django.db.migrations.writer import MigrationWriter
from django.test import TestCase
from django.utils.encoding import force_bytes
import six

from django_extensions.db.fields import AutoSlugField

from .testapp.models import ChildSluggedTestModel, SluggedTestModel, SluggedTestNoOverwriteOnAddModel
from .testapp.models import FKSluggedTestModel, FKSluggedTestModelCallable, FunctionSluggedTestModel
from .testapp.models import ModelMethodSluggedTestModel


@pytest.mark.usefixtures("admin_user")
class AutoSlugFieldTest(TestCase):
    def tearDown(self):
        super(AutoSlugFieldTest, self).tearDown()

        SluggedTestModel.objects.all().delete()

    def test_auto_create_slug(self):
        m = SluggedTestModel(title='foo')
        m.save()
        self.assertEqual(m.slug, 'foo')

    def test_auto_create_next_slug(self):
        m = SluggedTestModel(title='foo')
        m.save()<commit_msg>add back import needed for tests<commit_after># -*- coding: utf-8 -*-
import pytest
import django
from django.db import migrations, models
from django.db.migrations.writer import MigrationWriter
from django.test import TestCase
from django.utils.encoding import force_bytes
import six

import django_extensions  # noqa
from django_extensions.db.fields import AutoSlugField

from .testapp.models import ChildSluggedTestModel, SluggedTestModel, SluggedTestNoOverwriteOnAddModel
from .testapp.models import FKSluggedTestModel, FKSluggedTestModelCallable, FunctionSluggedTestModel
from .testapp.models import ModelMethodSluggedTestModel


@pytest.mark.usefixtures("admin_user")
class AutoSlugFieldTest(TestCase):
    def tearDown(self):
        super(AutoSlugFieldTest, self).tearDown()

        SluggedTestModel.objects.all().delete()

    def test_auto_create_slug(self):
        m = SluggedTestModel(title='foo')
        m.save()
        self.assertEqual(m.slug, 'foo')

    def test_auto_create_next_slug(self):
        m = SluggedTestModel(title='foo')
        m.save()
{'fraction_non_alphanumeric': 0.085727969348659, 'fraction_numerical': 0.0009578544061302681, 'mean_word_length': 4.818941504178273, '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': '3719538', 'n_tokens_mistral': 637, 'n_tokens_neox': 638, 'n_words': 139}