<commit_before>from pytest import mark
import six
import sqlalchemy as sa
from sqlalchemy_utils.types import timezone
from tests import TestCase


try:
    import dateutil

except ImportError:
    dateutil = None


@mark.skipif('dateutil is None')
class TestTimezoneType(TestCase):
    def create_models(self):
        class Visitor(self.Base):
            __tablename__ = 'document'
            id = sa.Column(sa.Integer, primary_key=True)
            timezone = sa.Column(timezone.TimezoneType)

            def __repr__(self):
                return 'Visitor(%r)' % self.id

        self.Visitor = Visitor

    def test_parameter_processing(self):
        visitor = self.Visitor(
            timezone=u'America/Los_Angeles'
        )

        self.session.add(visitor)
        self.session.commit()

        visitor = self.session.query(self.Visitor).filter_by(
            timezone='America/Los_Angeles').first()

        assert visitor is not None<commit_msg>unit test for dateutil and pytz<commit_after>from pytest import mark
import six
import sqlalchemy as sa
from sqlalchemy_utils.types import timezone
from tests import TestCase

import dateutil
import pytz


class TestTimezoneType(TestCase):
    def create_models(self):
        class Visitor(self.Base):
            __tablename__ = 'document'
            id = sa.Column(sa.Integer, primary_key=True)
            timezone_dateutil = sa.Column(timezone.TimezoneType(
                                          backend='dateutil'))
            timezone_pytz = sa.Column(timezone.TimezoneType(backend='pytz'))

            def __repr__(self):
                return 'Visitor(%r)' % self.id

        self.Visitor = Visitor

    def test_parameter_processing(self):
        visitor = self.Visitor(
            timezone_dateutil=u'America/Los_Angeles',
            timezone_pytz=u'America/Los_Angeles'
        )

        self.session.add(visitor)
        self.session.commit()

        visitor_dateutil = self.session.query(self.Visitor).filter_by(
            timezone_dateutil='America/Los_Angeles').first()
        visitor_pytz = self.session.query(self.Visitor).filter_by(
            timezone_pytz='America/Los_Angeles').first()

        assert visitor_dateutil is not None
        assert visitor_pytz is not None
{'fraction_non_alphanumeric': 0.08666959964804223, 'fraction_numerical': 0.0, 'mean_word_length': 2.51468315301391, '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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5422491', 'n_tokens_mistral': 659, 'n_tokens_neox': 650, 'n_words': 136}