<commit_before># -*- coding: utf-8 -*-

import factory
from factory import django

from django.contrib.auth.models import User


class UserFactory(django.DjangoModelFactory):
    FACTORY_FOR = User

    first_name = "Boy"
    last_name = factory.Sequence(lambda n: "Factory_%s" % n)
    email = factory.LazyAttribute(
        lambda a:
        <EMAIL>".format(a.first_name, a.last_name).lower())
    username = factory.Sequence(lambda n: "username_%s" % n)
    password = factory.PostGenerationMethodCall('set_password', '<PASSWORD>')
    is_active = True
    is_staff = False
    is_superuser = False<commit_msg>Fixed user factoriey to autocreate profile<commit_after># -*- coding: utf-8 -*-

import factory
from factory import django

from django.contrib.auth.models import User

from users.models import Profile


class ProfileFactory(django.DjangoModelFactory):
    class Meta:
        model = Profile

    user = factory.SubFactory('test.factories.UserFactory', profile=None)


class UserFactory(django.DjangoModelFactory):
    FACTORY_FOR = User

    first_name = "Boy"
    last_name = factory.Sequence(lambda n: "Factory_%s" % n)
    email = factory.LazyAttribute(
        lambda a:
        <EMAIL>".format(a.first_name, a.last_name).lower())
    username = factory.Sequence(lambda n: "username_%s" % n)
    password = factory.PostGenerationMethodCall('set_password', '<PASSWORD>')
    is_active = True
    is_staff = False
    is_superuser = False

    profile = factory.RelatedFactory(ProfileFactory, 'user')
{'fraction_non_alphanumeric': 0.11074489123269611, 'fraction_numerical': 0.0013183915622940012, 'mean_word_length': 3.8037974683544302, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '320808', 'n_tokens_mistral': 465, 'n_tokens_neox': 455, 'n_words': 108}