<commit_before># flake8: noqa
"""
Tests copied from cpython test suite:
https://github.com/python/cpython/blob/3.9/Lib/test/test_range.py
"""

# stdlib
import itertools
import pickle
import sys
import unittest

try:
    # stdlib
    from test.support import ALWAYS_EQ
except ImportError:

    class _ALWAYS_EQ:
        """
        https://github.com/python/cpython/blob/3.9/Lib/test/support/__init__.py
        Object that is equal to anything.
        """

        def __eq__(self, other):
            return True

        def __ne__(self, other):
            return False

    ALWAYS_EQ = _ALWAYS_EQ()


# pure Python implementations (3 args only), for comparison
def pyrange(start, stop, step):
    if (start - stop) // step < 0:
        # replace stop with next element in the sequence of integers
        # that are congruent to start modulo step.
        stop += (start - stop) % step
        while start != stop:
            yield start
            start += step


def pyrange_reversed(start, stop, step):
    stop += (start - stop) % step
    return pyrange(stop - step, start - step, -step)


class RangeTest(unittest.TestCase):
    def assert_iterators_equal(self, xs, ys, test_id, limit=None):
        # check that an iterator xs matches the expected results ys,
        # up to a given limit.
        if limit is not None:
            xs = itertools.islice(xs, limit)
            ys = itertools.islice(ys, limit)
        sentinel = object()
        pairs = itertools.zip_longest(xs, ys, fillvalue=sentinel)
        for i, (x, y) in enumerate(pairs):<commit_msg>Debugging failing range test<commit_after># flake8: noqa
"""
Tests copied from cpython test suite:
https://github.com/python/cpython/blob/3.9/Lib/test/test_range.py
"""

# stdlib
import itertools
import pickle
import sys
import unittest

try:
    # stdlib
    print("Try importing ALWAYS_EQ")
    # stdlib
    from test.support import ALWAYS_EQ
except Exception as e:
    print("Are we getting here?", e)

    class _ALWAYS_EQ:
        """
        https://github.com/python/cpython/blob/3.9/Lib/test/support/__init__.py
        Object that is equal to anything.
        """

        def __eq__(self, other):
            return True

        def __ne__(self, other):
            return False

    ALWAYS_EQ = _ALWAYS_EQ()


print("do we have ALWAYS_EQ", ALWAYS_EQ, type(ALWAYS_EQ))

# pure Python implementations (3 args only), for comparison
def pyrange(start, stop, step):
    if (start - stop) // step < 0:
        # replace stop with next element in the sequence of integers
        # that are congruent to start modulo step.
        stop += (start - stop) % step
        while start != stop:
            yield start
            start += step


def pyrange_reversed(start, stop, step):
    stop += (start - stop) % step
    return pyrange(stop - step, start - step, -step)


class RangeTest(unittest.TestCase):
    def assert_iterators_equal(self, xs, ys, test_id, limit=None):
        # check that an iterator xs matches the expected results ys,
        # up to a given limit.
        if limit is not None:
            xs = itertools.islice(xs, limit)
            ys = itertools.islice(ys, limit)
        sentinel = object()
        pairs = itertools.zip_longest(xs, ys, fillvalue=sentinel)
        for i, (x, y) in enumerate(pairs):
{'fraction_non_alphanumeric': 0.09939577039274924, 'fraction_numerical': 0.004229607250755287, 'mean_word_length': 2.423991726990693, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 4, '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': '5213490', 'n_tokens_mistral': 1053, 'n_tokens_neox': 1002, 'n_words': 325}