<commit_before>#!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.test import TestCase
from django.db import models

from ..models import Date, Publisher


class DateFields(TestCase):

    def test_date_insert(self):
        field = Date._meta.get_field_by_name('date_insert')[0]
        self.assertEqual(field.__class__, models.DateTimeField)
        self.assertTrue(field.auto_now_add)

    def test_date_update(self):
        field = Date._meta.get_field_by_name('date_update')[0]
        self.assertEqual(field.__class__, models.DateTimeField)
        self.assertTrue(field.auto_now)


class PublisherFields(TestCase):

    def test_site(self):
        field = Publisher._meta.get_field_by_name('site')[0]
        self.assertEqual(field.__class__, models.ForeignKey)

    def test_site_iid(self):
        field = Publisher._meta.get_field_by_name('site_iid')[0]
        self.assertEqual(field.__class__, models.PositiveIntegerField)
        self.assertEqual(field.max_length, 4)
        self.assertTrue(field.null)
        self.assertTrue(field.blank)
        self.assertTrue(field.db_index)

    def test_site_domain(self):
        field = Publisher._meta.get_field_by_name('site_domain')[0]
        self.assertEqual(field.__class__, models.CharField)
        self.assertEqual(field.max_length, 100)
        self.assertTrue(field.null)
        self.assertTrue(field.blank)
        self.assertTrue(field.db_index)

    def test_date_available(self):
        field = Publisher._meta.get_field_by_name('date_available')[0]
        self.assertEqual(field.__class__, models.DateTimeField)
        self.assertTrue(field.null)
        self.assertTrue(field.db_index)

    def test_published(self):
        field = Publisher._meta.get_field_by_name('published')[0]
        self.assertEqual(field.__class__, models.BooleanField)
        self.assertFalse(field.default)
        self.assertTrue(field.db_index)<commit_msg>test channeling fields<commit_after>#!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.test import TestCase
from django.db import models

from ..models import Date, Publisher, Slugged, Channeling
from ..models import Imaged


class DateFields(TestCase):

    def test_date_insert(self):
        field = Date._meta.get_field_by_name('date_insert')[0]
        self.assertEqual(field.__class__, models.DateTimeField)
        self.assertTrue(field.auto_now_add)

    def test_date_update(self):
        field = Date._meta.get_field_by_name('date_update')[0]
        self.assertEqual(field.__class__, models.DateTimeField)
        self.assertTrue(field.auto_now)


class PublisherFields(TestCase):

    def test_site(self):
        field = Publisher._meta.get_field_by_name('site')[0]
        self.assertEqual(field.__class__, models.ForeignKey)

    def test_site_iid(self):
        field = Publisher._meta.get_field_by_name('site_iid')[0]
        self.assertEqual(field.__class__, models.PositiveIntegerField)
        self.assertEqual(field.max_length, 4)
        self.assertTrue(field.null)
        self.assertTrue(field.blank)
        self.assertTrue(field.db_index)

    def test_site_domain(self):
        field = Publisher._meta.get_field_by_name('site_domain')[0]
        self.assertEqual(field.__class__, models.CharField)
        self.assertEqual(field.max_length, 100)
        self.assertTrue(field.null)
        self.assertTrue(field.blank)
        self.assertTrue(field.db_index)

    def test_date_available(self):
        field = Publisher._meta.get_field_by_name('date_available')[0]
        self.assertEqual(field.__class__, models.DateTimeField)
        self.assertTrue(field.null)
        self.assertTrue(field.db_index)

    def test_published(self):
        field = Publisher._meta.get_field_by_name('published')[0]
        self.assertEqual(field.__class__, models.BooleanField)
        self.assertFalse(field.default)
        self.assertTrue(field.db_index)


class ChannelingFields(TestCase):

    def test_channel(self):
        field = Channeling._meta.get_field_by_name('channel')[0]
        self.assertEqual(field.__class__, models.ForeignKey)
        self.assertEqual(field.verbose_name, u"Channel")

    def test_channel_name(self):
        field = Channeling._meta.get_field_by_name('channel_name')[0]
        self.assertEqual(field.__class__, models.CharField)
        self.assertEqual(field.max_length, 140)
        self.assertTrue(field.null)
        self.assertTrue(field.blank)
        self.assertTrue(field.db_index)

    def test_channel_long_slug(self):
        field = Channeling._meta.get_field_by_name('channel_long_slug')[0]
        self.assertEqual(field.__class__, models.CharField)
        self.assertEqual(field.max_length, 250)
        self.assertTrue(field.null)
        self.assertTrue(field.blank)
        self.assertTrue(field.db_index)


class SluggedTest(TestCase):

    def test_channel(self):
        field = Slugged._meta.get_field_by_name('slug')[0]
        self.assertEqual(field.__class__, models.SlugField)
        self.assertTrue(field.db_index)
        self.assertEqual(field.max_length, 150)


class ImagedTest(TestCase):

    def test_main_image(self):
        field = Imaged._meta.get_field_by_name('main_image')[0]
        self.assertEqual(field.__class__, models.ForeignKey)
        self.assertEqual(field.verbose_name, u'Main Image')

    def test_main_image_caption(self):
        field = Imaged._meta.get_field_by_name('main_image_caption')[0]
        self.assertEqual(field.__class__, models.CharField)
        self.assertEqual(field.max_length, 255)
        self.assertTrue(field.null)
        self.assertTrue(field.blank)

    def test_images(self):
        field = Imaged._meta.get_field_by_name('images')[0]
        self.assertEqual(field.__class__, models.ManyToManyField)
        self.assertTrue(field.null)
        self.assertTrue(field.blank)
{'fraction_non_alphanumeric': 0.10964762230585015, 'fraction_numerical': 0.00735545672254533, 'mean_word_length': 3.4907834101382487, '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': '1759156', 'n_tokens_mistral': 1799, 'n_tokens_neox': 1781, 'n_words': 237}