<commit_before>import six
import sqlalchemy as sa
from sqlalchemy_utils import IPAddressType
from tests import TestCase


class TestIPAddressType(TestCase):
    def create_models(self):
        class Visitor(self.Base):
            __tablename__ = 'document'
            id = sa.Column(sa.Integer, primary_key=True)
            ip_address = sa.Column(IPAddressType)

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

        self.Visitor = Visitor

    def test_parameter_processing(self):
        visitor = self.Visitor(
            ip_address=u'192.168.127.12'
        )

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

        visitor = self.session.query(self.Visitor).first()
        assert six.text_type(visitor.ip_address) == u'192.168.127.12'<commit_msg>Ipaddress tests marked as xfailed if ipaddress package not installed<commit_after>from pytest import mark
import six
import sqlalchemy as sa
from sqlalchemy_utils.types import ip_address
from tests import TestCase


@mark.xfail('ip_address.ipaddress is None')
class TestIPAddressType(TestCase):
    def create_models(self):
        class Visitor(self.Base):
            __tablename__ = 'document'
            id = sa.Column(sa.Integer, primary_key=True)
            ip_address = sa.Column(ip_address.IPAddressType)

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

        self.Visitor = Visitor

    def test_parameter_processing(self):
        visitor = self.Visitor(
            ip_address=u'192.168.127.12'
        )

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

        visitor = self.session.query(self.Visitor).first()
        assert six.text_type(visitor.ip_address) == u'192.168.127.12'
{'fraction_non_alphanumeric': 0.0962962962962963, 'fraction_numerical': 0.02507122507122507, 'mean_word_length': 2.620618556701031, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 4, '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': '86132', 'n_tokens_mistral': 557, 'n_tokens_neox': 515, 'n_words': 107}