<commit_before>from django.test import TestCase
from .models import Profile
from datetime import date


class ViewsTest(TestCase):
    """
    TestCase to test all exposed views for anonymous users.
    """

    def setUp(self):
        pass

    def testHome(self):
        response = self.client.get('/user/')
        self.assertEquals(response.status_code, 200)

    def testLogin(self):
        response = self.client.get('/user/login/')
        self.assertEquals(response.status_code, 200)

    def testLogout(self):
        response = self.client.get('/user/logout/')
        self.assertEquals(response.status_code, 302)
        self.assertRedirects(response, '/user/')


class ManagerTest(TestCase):
    """
    Test managers
    """
    fixtures = [
        'user.yaml',
        'profile.yaml',
    ]

    def setUp(self):
        pass

    def testCount(self):
        p = Profile.objects.count()
        self.assertEquals(p, 5)


class ModelTest(TestCase):
    """
    Test models
    """
    fixtures = [
        'user.yaml',
        'profile.yaml',
    ]

    def setUp(self):
        pass

    def testAge(self):
        p = Profile.objects.get(pk=1)
        age = (date.today() - p.dob).days / 365
        self.assertEquals(p.age, age)<commit_msg>more tests.<commit_after>from django.test import TestCase
from .models import Profile
from datetime import date


class ViewsTest(TestCase):
    """
    TestCase to test all exposed views for anonymous users.
    """

    def setUp(self):
        pass

    def testHome(self):
        response = self.client.get('/user/')
        self.assertEquals(response.status_code, 200)

    def testLogin(self):
        response = self.client.get('/user/login/')
        self.assertEquals(response.status_code, 200)

    def testLogout(self):
        response = self.client.get('/user/logout/')
        self.assertEquals(response.status_code, 302)
        self.assertRedirects(response, '/user/')


class ManagerTest(TestCase):
    """
    Test managers
    """
    fixtures = [
        'user.yaml',
        'profile.yaml',
    ]

    def setUp(self):
        pass

    def testCount(self):
        p = Profile.objects.count()
        self.assertEquals(p, 5)

    def testFemaleCount(self):
        p = Profile.objects.female_count()
        self.assertEquals(p, 3)

    def testMaleCount(self):
        p = Profile.objects.male_count()
        self.assertEquals(p, 5)


class ModelTest(TestCase):
    """
    Test models
    """
    fixtures = [
        'user.yaml',
        'profile.yaml',
    ]

    def setUp(self):
        pass

    def testAge(self):
        p = Profile.objects.get(pk=1)
        age = (date.today() - p.dob).days / 365
        self.assertEquals(p.age, age)

    def testAbsoluteUrl(self):
        url = Profile.objects.get(pk=1)
        self.assertEquals(url.get_absolute_url(), "/user/profile/1")
{'fraction_non_alphanumeric': 0.1281783350748868, 'fraction_numerical': 0.01114594218042494, 'mean_word_length': 2.2415349887133185, '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': '5791544', 'n_tokens_mistral': 918, 'n_tokens_neox': 850, 'n_words': 182}