<commit_before>"""Sample unittests."""

import unittest2 as unittest

from domain_models import model
from domain_models import fields


class User(model.DomainModel):
    """Example user domain model."""

    id = fields.Int()
    email = fields.String()
    first_name = fields.Unicode()
    last_name = fields.Unicode()
    gender = fields.String()
    birth_date = fields.String()

    __view_key__ = [id, email]
    __unique_key__ = id


class SampleTests(unittest.TestCase):
    """Sample tests tests."""

    def test_set_and_get_attrs(self):
        """Test setting and getting of domain model attributes."""
        user = User()
        user.id = 1
        user.email = '<EMAIL>'
        user.first_name = 'John'
        user.last_name = 'Smith'
        user.gender = 'male'
        user.birth_date = '05/04/1988'

        self.assertEqual(user.id, 1)
        self.assertEqual(user.email, '<EMAIL>')
        self.assertEqual(user.first_name, u'John')
        self.assertEqual(user.last_name, u'Smith')
        self.assertEqual(user.gender, 'male')
        self.assertEqual(user.birth_date, '05/04/1988')<commit_msg>Fix of tests with unicode strings<commit_after>"""Sample unittests."""

import unittest2 as unittest

from domain_models import model
from domain_models import fields


class User(model.DomainModel):
    """Example user domain model."""

    id = fields.Int()
    email = fields.String()
    first_name = fields.Unicode()
    last_name = fields.Unicode()
    gender = fields.String()
    birth_date = fields.String()

    __view_key__ = [id, email]
    __unique_key__ = id


class SampleTests(unittest.TestCase):
    """Sample tests tests."""

    def test_set_and_get_attrs(self):
        """Test setting and getting of domain model attributes."""
        user = User()
        user.id = 1
        user.email = '<EMAIL>'
        user.first_name = 'John'
        user.last_name = 'Smith'
        user.gender = 'male'
        user.birth_date = '05/04/1988'

        self.assertEqual(user.id, 1)
        self.assertEqual(user.email, '<EMAIL>')
        self.assertEqual(user.first_name, unicode('John'))
        self.assertEqual(user.last_name, unicode('Smith'))
        self.assertEqual(user.gender, 'male')
        self.assertEqual(user.birth_date, '05/04/1988')
{'fraction_non_alphanumeric': 0.12773403324584426, 'fraction_numerical': 0.016622922134733157, 'mean_word_length': 2.876271186440678, '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': '5680118', 'n_tokens_mistral': 731, 'n_tokens_neox': 683, 'n_words': 160}