<commit_before>from __future__ import unicode_literals

import unittest

from django.conf import settings
from django.test import TestCase

import factory

from ..models import Gallery, Photo


class UserFactory(factory.django.DjangoModelFactory):
    FACTORY_FOR = settings.AUTH_USER_MODEL


class GalleryFactory(factory.django.DjangoModelFactory):
    FACTORY_FOR = Gallery
    author = factory.SubFactory(UserFactory)


class PhotoFactory(factory.django.DjangoModelFactory):
    FACTORY_FOR = Photo
    gallery = factory.SubFactory(GalleryFactory)
    author = factory.LazyAttribute(lambda obj: obj.gallery.author)
    image = factory.django.ImageField(width=1024, height=768)


class GalleryModelTestCase(unittest.TestCase):<commit_msg>Updated tests for factory-boy Meta class.<commit_after>from __future__ import unicode_literals

import unittest

from django.conf import settings
from django.test import TestCase

import factory

from ..models import Gallery, Photo


class UserFactory(factory.django.DjangoModelFactory):
    class Meta:
        model = settings.AUTH_USER_MODEL


class GalleryFactory(factory.django.DjangoModelFactory):
    author = factory.SubFactory(UserFactory)

    class Meta:
        model = Gallery


class PhotoFactory(factory.django.DjangoModelFactory):
    gallery = factory.SubFactory(GalleryFactory)
    author = factory.LazyAttribute(lambda obj: obj.gallery.author)
    image = factory.django.ImageField(width=1024, height=768)

    class Meta:
        model = Photo


class GalleryModelTestCase(unittest.TestCase):
{'fraction_non_alphanumeric': 0.07280927835051547, 'fraction_numerical': 0.00902061855670103, 'mean_word_length': 4.927480916030534, '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': '97866', 'n_tokens_mistral': 445, 'n_tokens_neox': 420, 'n_words': 102}