<commit_before>import pytest

from tcopy import tco


def fib(n, x=1, y=1):
    if n == 0:
        return x
    return fib(n - 1, y, x + y)


def test_fib_1000_no_tco():
    with pytest.raises(RuntimeError):
        fib(1000)


def test_fib_1000_with_tco():
    assert tco(fib)(1000)


def test_nested():
    def f():
        @tco
        def fact(n, a=1):
            if n == 0:
                return a
            return fact(n - 1, a * n)

        return fact

    assert f()(1000)


def test_closures():
    def f():
        one = 1

        @tco
        def fact(n, a=1):
            if n == 0:
                return a
            return fact(n - one, a * n)

        return fact

    assert f()(1000)<commit_msg>check returned values in tests<commit_after>import pytest

from tcopy import tco


def fib_(n):
    x, y = 1, 1
    while n > 0:
        n, x, y = n - 1, y, x + y
    return x


def fact_(n):
    k = 1
    while n > 0:
        k *= n
        n -= 1
    return k


def fib(n, x=1, y=1):
    if n == 0:
        return x
    return fib(n - 1, y, x + y)


def test_fib_1000_no_tco():
    with pytest.raises(RuntimeError):
        fib(1000)


def test_fib_1000_with_tco():
    assert tco(fib)(1000) == fib_(1000)


def test_nested():
    def f():
        @tco
        def fact(n, a=1):
            if n == 0:
                return a
            return fact(n - 1, a * n)

        return fact

    assert f()(1000) == fact_(1000)


def test_closures():
    def f():
        one = 1

        @tco
        def fact(n, a=1):
            if n == 0:
                return a
            return fact(n - one, a * n)

        return fact

    assert f()(1000) == fact_(1000)
{'fraction_non_alphanumeric': 0.12187871581450654, 'fraction_numerical': 0.05172413793103448, 'mean_word_length': 1.4605263157894737, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '463153', 'n_tokens_mistral': 693, 'n_tokens_neox': 599, 'n_words': 190}