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

from datetime import datetime
from unittest import TestCase

from nose2.tools import params

from byceps.blueprints.user.models import User
from byceps.util.image import ImageType


NOW = datetime.now()


class AvatarImageTestCase(TestCase):

    def setUp(self):
        self.user = User()

    @params(
        (None, None          , False),
        (NOW , None          , False),
        (None, ImageType.jpeg, False),
        (NOW , ImageType.jpeg, True ),
    )
    def test_has_avatar_image(self, created_at, image_type, expected):
        self.user.avatar_image_created_at = created_at
        self.user.avatar_image_type = image_type

        self.assertEquals(self.user.has_avatar_image, expected)

    @params(
        (None  , None          ),
        ('gif' , ImageType.gif ),
        ('jpeg', ImageType.jpeg),
        ('png' , ImageType.png ),
    )
    def test_get_avatar_image_type(self, database_value, expected):
        self.user._avatar_image_type = database_value

        self.assertEquals(self.user.avatar_image_type, expected)

    @params(
        (None          , None  ),
        (ImageType.gif , 'gif' ),
        (ImageType.jpeg, 'jpeg'),
        (ImageType.png , 'png' ),
    )
    def test_set_avatar_image_type(self, image_type, expected):
        self.user.avatar_image_type = image_type

        self.assertEquals(self.user._avatar_image_type, expected)<commit_msg>Renamed test methods.<commit_after># -*- coding: utf-8 -*-

from datetime import datetime
from unittest import TestCase

from nose2.tools import params

from byceps.blueprints.user.models import User
from byceps.util.image import ImageType


NOW = datetime.now()


class AvatarImageTestCase(TestCase):

    def setUp(self):
        self.user = User()

    @params(
        (None, None          , False),
        (NOW , None          , False),
        (None, ImageType.jpeg, False),
        (NOW , ImageType.jpeg, True ),
    )
    def test_has_avatar_image(self, created_at, image_type, expected):
        self.user.avatar_image_created_at = created_at
        self.user.avatar_image_type = image_type

        self.assertEquals(self.user.has_avatar_image, expected)

    @params(
        (None  , None          ),
        ('gif' , ImageType.gif ),
        ('jpeg', ImageType.jpeg),
        ('png' , ImageType.png ),
    )
    def test_hybrid_image_type_getter(self, database_value, expected):
        self.user._avatar_image_type = database_value

        self.assertEquals(self.user.avatar_image_type, expected)

    @params(
        (None          , None  ),
        (ImageType.gif , 'gif' ),
        (ImageType.jpeg, 'jpeg'),
        (ImageType.png , 'png' ),
    )
    def test_hybrid_image_type_setter(self, image_type, expected):
        self.user.avatar_image_type = image_type

        self.assertEquals(self.user._avatar_image_type, expected)
{'fraction_non_alphanumeric': 0.11038062283737024, 'fraction_numerical': 0.001384083044982699, 'mean_word_length': 2.542892156862745, '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': '6976725', 'n_tokens_mistral': 929, 'n_tokens_neox': 888, 'n_words': 179}