<commit_before>try:
    from txampext import axiomtypes; axiomtypes
    from axiom import attributes
except ImportError:
    axiomtypes = None

from twisted.protocols import amp
from twisted.trial import unittest


class TypeForTests(unittest.TestCase):
    skip = axiomtypes is None

    def _test_typeFor(self, attr, expectedType, **kwargs):
        asAMP = axiomtypes.typeFor(attr, **kwargs)
        self.assertTrue(isinstance(asAMP, expectedType))
        return asAMP


    def test_optional(self):
        asAMP = axiomtypes.typeFor(attributes.text(), optional=True)
        self.assertTrue(asAMP.optional)


    def test_text(self):
        self._test_typeFor(attributes.text(), amp.Unicode)


    def test_bytes(self):
        self._test_typeFor(attributes.bytes(), amp.String)


    def test_integer(self):
        self._test_typeFor(attributes.integer(), amp.Integer)


    def test_decimals(self):
        for precision in range(1, 11):
            attr = getattr(attributes, "point{}decimal".format(precision))
            self._test_typeFor(attr(), amp.Decimal)

        self._test_typeFor(attributes.money(), amp.Decimal)


    def test_float(self):
        self._test_typeFor(attributes.ieee754_double(), amp.Float)


    def test_timestamp(self):
        self._test_typeFor(attributes.timestamp(), amp.DateTime)
<commit_msg>Add 'no cover' pragma to hide bogus missing code coverage<commit_after>try:
    from txampext import axiomtypes; axiomtypes
    from axiom import attributes
except ImportError:  # pragma: no cover
    axiomtypes = None

from twisted.protocols import amp
from twisted.trial import unittest


class TypeForTests(unittest.TestCase):
    skip = axiomtypes is None

    def _test_typeFor(self, attr, expectedType, **kwargs):
        asAMP = axiomtypes.typeFor(attr, **kwargs)
        self.assertTrue(isinstance(asAMP, expectedType))
        return asAMP


    def test_optional(self):
        asAMP = axiomtypes.typeFor(attributes.text(), optional=True)
        self.assertTrue(asAMP.optional)


    def test_text(self):
        self._test_typeFor(attributes.text(), amp.Unicode)


    def test_bytes(self):
        self._test_typeFor(attributes.bytes(), amp.String)


    def test_integer(self):
        self._test_typeFor(attributes.integer(), amp.Integer)


    def test_decimals(self):
        for precision in range(1, 11):
            attr = getattr(attributes, "point{}decimal".format(precision))
            self._test_typeFor(attr(), amp.Decimal)

        self._test_typeFor(attributes.money(), amp.Decimal)


    def test_float(self):
        self._test_typeFor(attributes.ieee754_double(), amp.Float)


    def test_timestamp(self):
        self._test_typeFor(attributes.timestamp(), amp.DateTime)

{'fraction_non_alphanumeric': 0.10276967930029154, 'fraction_numerical': 0.004373177842565598, 'mean_word_length': 3.4345718901453957, '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': '2625980', 'n_tokens_mistral': 871, 'n_tokens_neox': 796, 'n_words': 172}