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

import json
import mock
import datetime

from custom.icds_reports.views import PrevalenceOfUndernutritionView, AwcReportsView, \
    PrevalenceOfSevereView, PrevalenceOfStuntingView, NewbornsWithLowBirthWeightView, \
    EarlyInitiationBreastfeeding, ExclusiveBreastfeedingView, ChildrenInitiatedView, InstitutionalDeliveriesView, \
    ImmunizationCoverageView, AWCsCoveredView, RegisteredHouseholdView, EnrolledChildrenView, \
    EnrolledWomenView, LactatingEnrolledWomenView, AdolescentGirlsView, AdhaarBeneficiariesView, CleanWaterView, \
    FunctionalToiletView, MedicineKitView, InfantsWeightScaleView, AdultWeightScaleView
from corehq.apps.users.models import WebUser
from corehq.apps.domain.models import Domain


class LastDayOfJune(datetime.datetime):
    @classmethod
    def utcnow(cls):
        return datetime.datetime(2017, 5, 31)


class FirstDayOfJuly(datetime.datetime):
    @classmethod
    def utcnow(cls):
        return datetime.datetime(2017, 6, 1)


class SecondDayOfJuly(datetime.datetime):
    @classmethod
    def utcnow(cls):
        return datetime.datetime(2017, 6, 2)


class ThirdDayOfJuly(datetime.datetime):
    @classmethod
    def utcnow(cls):
        return datetime.datetime(2017, 6, 3)


class Base(TestCase):

    def setUp(self):
        self.factory = None
        self.user = None
        self.view = None
        self.url = None
        self.run_july_third_test = False

    def _setup_domain_and_user(self):
        domain = Domain.get_or_create_with_name('icds-test')
        domain.is_active = True
        domain.save()
        user = WebUser.create('icds-test', 'test', '<PASSWORD>', is_admin=True)
        user.is_authenticated = True
        user.is_superuser = False
        user.is_active = True
        self.user = user<commit_msg>extract domain to a constant member<commit_after>from django.test.testcases import TestCase
from django.test.client import RequestFactory
from django.core.urlresolvers import reverse

import json
import mock
import datetime

from custom.icds_reports.views import PrevalenceOfUndernutritionView, AwcReportsView, \
    PrevalenceOfSevereView, PrevalenceOfStuntingView, NewbornsWithLowBirthWeightView, \
    EarlyInitiationBreastfeeding, ExclusiveBreastfeedingView, ChildrenInitiatedView, InstitutionalDeliveriesView, \
    ImmunizationCoverageView, AWCsCoveredView, RegisteredHouseholdView, EnrolledChildrenView, \
    EnrolledWomenView, LactatingEnrolledWomenView, AdolescentGirlsView, AdhaarBeneficiariesView, CleanWaterView, \
    FunctionalToiletView, MedicineKitView, InfantsWeightScaleView, AdultWeightScaleView
from corehq.apps.users.models import WebUser
from corehq.apps.domain.models import Domain


class LastDayOfJune(datetime.datetime):
    @classmethod
    def utcnow(cls):
        return datetime.datetime(2017, 5, 31)


class FirstDayOfJuly(datetime.datetime):
    @classmethod
    def utcnow(cls):
        return datetime.datetime(2017, 6, 1)


class SecondDayOfJuly(datetime.datetime):
    @classmethod
    def utcnow(cls):
        return datetime.datetime(2017, 6, 2)


class ThirdDayOfJuly(datetime.datetime):
    @classmethod
    def utcnow(cls):
        return datetime.datetime(2017, 6, 3)


class Base(TestCase):
    DOMAIN_NAME = 'icds-test'

    def setUp(self):
        self.factory = None
        self.user = None
        self.view = None
        self.url = None
        self.run_july_third_test = False

    def _setup_domain_and_user(self):
        domain = Domain.get_or_create_with_name(self.DOMAIN_NAME)
        domain.is_active = True
        domain.save()
        user = WebUser.create('icds-test', 'test', '<PASSWORD>', is_admin=True)
        user.is_authenticated = True
        user.is_superuser = False
        user.is_active = True
        self.user = user
{'fraction_non_alphanumeric': 0.07733401170185704, 'fraction_numerical': 0.01271940981938438, 'mean_word_length': 3.9646464646464645, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '2494102', 'n_tokens_mistral': 1267, 'n_tokens_neox': 1160, 'n_words': 248}