<commit_before>from cms import externals
from cms.apps.pages.models import Page
from django.contrib.contenttypes.models import ContentType
from django.test import TestCase

from ..models import People, Person


class ApplicationTestCase(TestCase):

    def setUp(self):
        # Note: as this is the only page in the database, it's absolute URL
        # will simply be '/'

        with externals.watson.context_manager("update_index")():
            content_type = ContentType.objects.get_for_model(People)
            self.page = Page.objects.create(
                content_type=content_type,
                title='Foo',
                url_title='foo',
            )

            self.person_page = People.objects.create(
                page=self.page,
            )

        self.person = Person.objects.create(
            page=self.page,
            url_title='foo-bar',
            first_name='Foo',
            last_name='Bar',
        )

    def test_person_get_absolute_url(self):
        self.assertEqual(self.person.get_absolute_url(), '/foo-bar/')

    def test_person_unicode(self):
        self.assertEqual(self.person.__unicode__(), 'Foo Bar')
<commit_msg>Fix old `url_title` references.<commit_after>from cms import externals
from cms.apps.pages.models import Page
from django.contrib.contenttypes.models import ContentType
from django.test import TestCase

from ..models import People, Person


class ApplicationTestCase(TestCase):

    def setUp(self):
        # Note: as this is the only page in the database, it's absolute URL
        # will simply be '/'

        with externals.watson.context_manager("update_index")():
            content_type = ContentType.objects.get_for_model(People)
            self.page = Page.objects.create(
                content_type=content_type,
                title='Foo',
                slug='foo',
            )

            self.person_page = People.objects.create(
                page=self.page,
            )

        self.person = Person.objects.create(
            page=self.page,
            url_title='foo-bar',
            first_name='Foo',
            last_name='Bar',
        )

    def test_person_get_absolute_url(self):
        self.assertEqual(self.person.get_absolute_url(), '/foo-bar/')

    def test_person_unicode(self):
        self.assertEqual(self.person.__unicode__(), 'Foo Bar')

{'fraction_non_alphanumeric': 0.10012674271229405, 'fraction_numerical': 0.0, 'mean_word_length': 2.2482853223593966, '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': '3288125', 'n_tokens_mistral': 669, 'n_tokens_neox': 634, 'n_words': 139}