<commit_before>import sys

import pytest

from diofant import (Abs, acos, acosh, Add, asin, asinh, atan, Ci,
                     cos, sinh, cosh, tanh, Derivative, diff, DiracDelta, E,
                     exp, erf, erfi, EulerGamma, factor, Function, I,
                     Integral, integrate, Interval, Lambda, LambertW, log,
                     Matrix, O, oo, pi, Piecewise, Poly, Rational, S,
                     simplify, sin, tan, sqrt, sstr, Sum, Symbol, symbols,
                     sympify, trigsimp, Integer, Tuple, nan, And, Eq, Ne, re,
                     im, polar_lift, meijerg, Min, Max)
from diofant.functions.elementary.complexes import periodic_argument
from diofant.integrals.risch import NonElementaryIntegral
from diofant.utilities.randtest import verify_numerically

__all__ = ()

x, y, a, t, x_1, x_2, z, s = symbols('x y a t x_1 x_2 z s')
n = Symbol('n', integer=True)
f = Function('f')


def diff_test(i):
    """Return the set of symbols, s, which were used in testing that
    i.diff(s) agrees with i.doit().diff(s). If there is an error then
    the assertion will fail, causing the test to fail.
    """
    syms = i.free_symbols
    for s in syms:
        assert (i.diff(s).doit() - i.doit().diff(s)).expand() == 0
    return syms


def test_improper_integral():
    assert integrate(log(x), (x, 0, 1)) == -1
    assert integrate(x**(-2), (x, 1, oo)) == 1


def test_constructor():
    # this is shared by Sum, so testing Integral's constructor
    # is equivalent to testing Sum's
    s1 = Integral(n, n)
    assert s1.limits == (Tuple(n),)
    s2 = Integral(n, (n,))<commit_msg>Add regression test<commit_after>import sys

import pytest

from diofant import (Abs, acos, acosh, Add, asin, asinh, atan, Ci,
                     cos, sinh, cosh, tanh, Derivative, diff, DiracDelta, E,
                     exp, erf, erfi, EulerGamma, factor, Function, I,
                     Integral, integrate, Interval, Lambda, LambertW, log,
                     Matrix, O, oo, pi, Piecewise, Poly, Rational, S,
                     simplify, sin, tan, sqrt, sstr, Sum, Symbol, symbols,
                     sympify, trigsimp, Integer, Tuple, nan, And, Eq, Ne, re,
                     im, polar_lift, meijerg, Min, Max)
from diofant.functions.elementary.complexes import periodic_argument
from diofant.integrals.risch import NonElementaryIntegral
from diofant.utilities.randtest import verify_numerically

__all__ = ()

x, y, a, t, x_1, x_2, z, s = symbols('x y a t x_1 x_2 z s')
n = Symbol('n', integer=True)
f = Function('f')


def diff_test(i):
    """Return the set of symbols, s, which were used in testing that
    i.diff(s) agrees with i.doit().diff(s). If there is an error then
    the assertion will fail, causing the test to fail.
    """
    syms = i.free_symbols
    for s in syms:
        assert (i.diff(s).doit() - i.doit().diff(s)).expand() == 0
    return syms


def test_improper_integral():
    assert integrate(log(x), (x, 0, 1)) == -1
    assert integrate(x**(-2), (x, 1, oo)) == 1

    # issue sympy/sympy#10445:
    assert integrate(1/(1 + exp(x)), (x, 0, oo)) == log(2)


def test_constructor():
    # this is shared by Sum, so testing Integral's constructor
    # is equivalent to testing Sum's
    s1 = Integral(n, n)
    assert s1.limits == (Tuple(n),)
    s2 = Integral(n, (n,))
{'fraction_non_alphanumeric': 0.12578805163614531, 'fraction_numerical': 0.011107775442809968, 'mean_word_length': 2.6615384615384614, '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': '1677502', 'n_tokens_mistral': 1178, 'n_tokens_neox': 1119, 'n_words': 378}