<commit_before>from datetime import timedelta
import re

import factory
import faker


from .dates import date_in_near_future, FOUR_YEARS_IN_DAYS

faker_factory = faker.Factory.create()


class PartySetFactory(factory.DjangoModelFactory):
    class Meta:
        model = "candidates.PartySet"


class ParliamentaryChamberFactory(factory.DjangoModelFactory):
    class Meta:
        model = "popolo.Organization"

    name = "House of Commons"
    slug = "commons"


class BaseElectionFactory(factory.DjangoModelFactory):
    class Meta:
        model = "elections.Election"
        abstract = True

    slug = "sp.2016-05-05"
    for_post_role = "Member of the Scottish Parliament"
    winner_membership_role = None
    candidate_membership_role = "Candidate"
    election_date = date_in_near_future
    name = "Scottish Parliamentary elections"
    current = True
    use_for_candidate_suggestions = False
    party_lists_in_use = False<commit_msg>Use actual election date when creating factory slug<commit_after>from datetime import timedelta
import re

import factory
import faker


from .dates import date_in_near_future, FOUR_YEARS_IN_DAYS

faker_factory = faker.Factory.create()


class PartySetFactory(factory.DjangoModelFactory):
    class Meta:
        model = "candidates.PartySet"


class ParliamentaryChamberFactory(factory.DjangoModelFactory):
    class Meta:
        model = "popolo.Organization"

    name = "House of Commons"
    slug = "commons"


class BaseElectionFactory(factory.DjangoModelFactory):
    class Meta:
        model = "elections.Election"
        abstract = True

    slug = factory.LazyAttribute(lambda o: "sp.%s" % o.election_date)

    for_post_role = "Member of the Scottish Parliament"
    winner_membership_role = None
    candidate_membership_role = "Candidate"
    election_date = date_in_near_future
    name = "Scottish Parliamentary elections"
    current = True
    use_for_candidate_suggestions = False
    party_lists_in_use = False
{'fraction_non_alphanumeric': 0.06717171717171717, 'fraction_numerical': 0.00404040404040404, 'mean_word_length': 3.9401496259351623, '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': '808181', 'n_tokens_mistral': 622, 'n_tokens_neox': 585, 'n_words': 143}