<commit_before># -*- coding: utf-8 -*-
import unittest
import datetime
from odin import datetimeutil
from odin import serializers


class SerializerTestCase(unittest.TestCase):
    def test_date_iso_format(self):
        self.assertEqual("2014-01-16", serializers.date_iso_format(datetime.date(2014, 01, 16)))

    def test_time_iso_format(self):
        self.assertEqual(
            "00:29:32+00:00",
            serializers.TimeIsoFormat(datetimeutil.utc)(
                datetime.time(0, 29, 32)))
        self.assertEqual(
            "00:29:32+10:00",
            serializers.TimeIsoFormat(datetimeutil.utc)(
                datetime.time(0, 29, 32, tzinfo=datetimeutil.FixedTimezone(10, 0, "10:00"))))

        self.assertEqual(
            "00:29:32-03:30",
            serializers.TimeIsoFormat(datetimeutil.FixedTimezone(-3, -30, 'TEST'))(
                datetime.time(0, 29, 32)))
        self.assertEqual(
            "00:29:32+10:00",
            serializers.TimeIsoFormat(datetimeutil.FixedTimezone(-3, -30, 'TEST'))(
                datetime.time(0, 29, 32, tzinfo=datetimeutil.FixedTimezone(10, 0, "10:00"))))

    def test_datetime_iso_format(self):
        self.assertEqual(
            "2014-01-16T00:29:32+00:00",
            serializers.DatetimeIsoFormat(datetimeutil.utc)(
                datetime.datetime(2014, 01, 16, 0, 29, 32)))
        self.assertEqual(
            "2014-01-16T00:29:32+10:00",
            serializers.DatetimeIsoFormat(datetimeutil.utc)(
                datetime.datetime(2014, 01, 16, 0, 29, 32, tzinfo=datetimeutil.FixedTimezone(10, 0, "10:00"))))

        self.assertEqual(
            "2014-01-16T00:29:32-03:30",
            serializers.DatetimeIsoFormat(datetimeutil.FixedTimezone(-3, -30, 'TEST'))(
                datetime.datetime(2014, 01, 16, 0, 29, 32)))
        self.assertEqual(
            "2014-01-16T00:29:32+10:00",
            serializers.DatetimeIsoFormat(datetimeutil.FixedTimezone(-3, -30, 'TEST'))(
                datetime.datetime(2014, 01, 16, 0, 29, 32, tzinfo=datetimeutil.FixedTimezone(10, 0, "10:00"))))

    def test_datetime_ecma_format(self):
        self.assertEqual(
            "2014-01-16T00:29:32.000Z",
            serializers.DatetimeEcmaFormat(False, default_timezone=datetimeutil.utc)(
                datetime.datetime(2014, 01, 16, 0, 29, 32)))
        self.assertEqual(
            "2014-01-15T14:29:32.000Z",
            serializers.DatetimeEcmaFormat(False, default_timezone=datetimeutil.utc)(
                datetime.datetime(2014, 01, 16, 0, 29, 32, tzinfo=datetimeutil.FixedTimezone(10, 0, "10:00"))))

        self.assertEqual(
            "2014-01-16T03:59:32.000Z",
            serializers.DatetimeEcmaFormat(False, default_timezone=datetimeutil.FixedTimezone(-3, -30, 'TEST'))(
                datetime.datetime(2014, 01, 16, 0, 29, 32)))
        self.assertEqual(
            "2014-01-15T14:29:32.000Z",
            serializers.DatetimeEcmaFormat(False, default_timezone=datetimeutil.FixedTimezone(-3, -30, 'TEST'))(
                datetime.datetime(2014, 01, 16, 0, 29, 32, tzinfo=datetimeutil.FixedTimezone(10, 0, "10:00"))))
<commit_msg>Python 3 gotcha, numbers can't start with leading 0's<commit_after># -*- coding: utf-8 -*-
import unittest
import datetime
from odin import datetimeutil
from odin import serializers


class SerializerTestCase(unittest.TestCase):
    def test_date_iso_format(self):
        self.assertEqual("2014-01-16", serializers.date_iso_format(datetime.date(2014, 1, 16)))

    def test_time_iso_format(self):
        self.assertEqual(
            "00:29:32+00:00",
            serializers.TimeIsoFormat(datetimeutil.utc)(
                datetime.time(0, 29, 32)))
        self.assertEqual(
            "00:29:32+10:00",
            serializers.TimeIsoFormat(datetimeutil.utc)(
                datetime.time(0, 29, 32, tzinfo=datetimeutil.FixedTimezone(10, 0, "10:00"))))

        self.assertEqual(
            "00:29:32-03:30",
            serializers.TimeIsoFormat(datetimeutil.FixedTimezone(-3, -30, 'TEST'))(
                datetime.time(0, 29, 32)))
        self.assertEqual(
            "00:29:32+10:00",
            serializers.TimeIsoFormat(datetimeutil.FixedTimezone(-3, -30, 'TEST'))(
                datetime.time(0, 29, 32, tzinfo=datetimeutil.FixedTimezone(10, 0, "10:00"))))

    def test_datetime_iso_format(self):
        self.assertEqual(
            "2014-01-16T00:29:32+00:00",
            serializers.DatetimeIsoFormat(datetimeutil.utc)(
                datetime.datetime(2014, 1, 16, 0, 29, 32)))
        self.assertEqual(
            "2014-01-16T00:29:32+10:00",
            serializers.DatetimeIsoFormat(datetimeutil.utc)(
                datetime.datetime(2014, 1, 16, 0, 29, 32, tzinfo=datetimeutil.FixedTimezone(10, 0, "10:00"))))

        self.assertEqual(
            "2014-01-16T00:29:32-03:30",
            serializers.DatetimeIsoFormat(datetimeutil.FixedTimezone(-3, -30, 'TEST'))(
                datetime.datetime(2014, 1, 16, 0, 29, 32)))
        self.assertEqual(
            "2014-01-16T00:29:32+10:00",
            serializers.DatetimeIsoFormat(datetimeutil.FixedTimezone(-3, -30, 'TEST'))(
                datetime.datetime(2014, 1, 16, 0, 29, 32, tzinfo=datetimeutil.FixedTimezone(10, 0, "10:00"))))

    def test_datetime_ecma_format(self):
        self.assertEqual(
            "2014-01-16T00:29:32.000Z",
            serializers.DatetimeEcmaFormat(False, default_timezone=datetimeutil.utc)(
                datetime.datetime(2014, 1, 16, 0, 29, 32)))
        self.assertEqual(
            "2014-01-15T14:29:32.000Z",
            serializers.DatetimeEcmaFormat(False, default_timezone=datetimeutil.utc)(
                datetime.datetime(2014, 1, 16, 0, 29, 32, tzinfo=datetimeutil.FixedTimezone(10, 0, "10:00"))))

        self.assertEqual(
            "2014-01-16T03:59:32.000Z",
            serializers.DatetimeEcmaFormat(False, default_timezone=datetimeutil.FixedTimezone(-3, -30, 'TEST'))(
                datetime.datetime(2014, 1, 16, 0, 29, 32)))
        self.assertEqual(
            "2014-01-15T14:29:32.000Z",
            serializers.DatetimeEcmaFormat(False, default_timezone=datetimeutil.FixedTimezone(-3, -30, 'TEST'))(
                datetime.datetime(2014, 1, 16, 0, 29, 32, tzinfo=datetimeutil.FixedTimezone(10, 0, "10:00"))))

{'fraction_non_alphanumeric': 0.14222433159310235, 'fraction_numerical': 0.11944312608764436, 'mean_word_length': 2.622922636103152, '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': '5254942', 'n_tokens_mistral': 2587, 'n_tokens_neox': 2024, 'n_words': 326}