This is the code along with documentation
from sympy import diff, integrate, sympify, expand, Symbol
x=Symbol('x')
def Delta(expr, d = 1):
"""Takes as input function expression and returns the diffrence
between final value(function's expression incremented to 1) and
initial value (function
It doesn't work because you've hard-coded the symbol x into the
function, and then used a different one in the tests (Symbol("x",
real=True) != Symbol("x")). Generally functions like this take a
parameter for the variable, like Delta(expr, x, d=1).
Unrelated: why are you using integrate to compute