<commit_before>from django.test import TestCase
from django.core.urlresolvers import reverse

from tests.app.models import NewsIndex, NewsItem

from taggit.models import Tag

from wagtail.wagtailcore.models import Page
from wagtail.tests.utils import WagtailTestUtils


class TestNewItemWithTags(TestCase, WagtailTestUtils):

    def setUp(self):
        root_page = Page.objects.get(pk=2)
        self.index = NewsIndex(
            title='News', slug='news')
        root_page.add_child(instance=self.index)

    def test_create_item_with_tags(self):
        item = NewsItem.objects.create(
            newsindex=self.index,
            title='News post!')
        item.tags = ['hello', 'world']

        # Get a fresh one from the DB
        item = NewsItem.objects.get()
        self.assertQuerysetEqual(item.tags.order_by('name'),
                                 Tag.objects.order_by('name'))

    def test_create_item_admin(self):
        create_url = reverse('wagtailnews_create', kwargs={'pk': self.index.pk})<commit_msg>Fix typo in test name<commit_after>from django.test import TestCase
from django.core.urlresolvers import reverse

from tests.app.models import NewsIndex, NewsItem

from taggit.models import Tag

from wagtail.wagtailcore.models import Page
from wagtail.tests.utils import WagtailTestUtils


class TestNewsItemWithTags(TestCase, WagtailTestUtils):

    def setUp(self):
        root_page = Page.objects.get(pk=2)
        self.index = NewsIndex(
            title='News', slug='news')
        root_page.add_child(instance=self.index)

    def test_create_item_with_tags(self):
        item = NewsItem.objects.create(
            newsindex=self.index,
            title='News post!')
        item.tags = ['hello', 'world']

        # Get a fresh one from the DB
        item = NewsItem.objects.get()
        self.assertQuerysetEqual(item.tags.order_by('name'),
                                 Tag.objects.order_by('name'))

    def test_create_item_admin(self):
        create_url = reverse('wagtailnews_create', kwargs={'pk': self.index.pk})
{'fraction_non_alphanumeric': 0.10246495891735138, 'fraction_numerical': 0.0009666505558240696, 'mean_word_length': 2.942857142857143, '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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6843531', 'n_tokens_mistral': 622, 'n_tokens_neox': 615, 'n_words': 131}