Repository: diofant/diofant

Issue:
Cleanup XFAILed tests
* validate XFAILed tests, check if some actually pass, like ``test_issue_4326()``
* remove slow tests
* enable xfail_strict (at least for Travis builds)

Also check out skipif(True) tests.  Probably, should be removed.


Discussion:

Resolving patch:
diff --git a/diofant/printing/lambdarepr.py b/diofant/printing/lambdarepr.py
--- a/diofant/printing/lambdarepr.py
+++ b/diofant/printing/lambdarepr.py
@@ -246,6 +246,15 @@ def _print_Sum(self, expr):
     def _print_Infinity(self, expr):
         return "inf"
 
+    def _print_Float(self, e):
+        # XXX: This does not handle setting mpmath.mp.dps. It is assumed that
+        # the caller of the lambdified function will have set it to sufficient
+        # precision to match the Floats in the expression.
+
+        # Remove 'mpz' if gmpy is installed.
+        args = str(tuple(map(int, e._mpf_)))
+        return 'mpf(%s)' % args
+
 
 def lambdarepr(expr, **settings):
     """
diff --git a/diofant/solvers/ode.py b/diofant/solvers/ode.py
--- a/diofant/solvers/ode.py
+++ b/diofant/solvers/ode.py
@@ -1846,8 +1846,8 @@ def check_nonlinear_2eq_order1(eq, func, func_coef):
     if not (r1 and r2):
         r1 = eq[0].match(diff(x(t), t) - x(t)/t + f/t)
         r2 = eq[1].match(diff(y(t), t) - y(t)/t + g/t)
-    if r1 and r2 and not (r1[f].subs({diff(x(t), t): u}).subs({diff(y(t), t): v}).has(t)
-                          or r2[g].subs({diff(x(t), t): u}).subs({diff(y(t), t): v}).has(t)):
+    if r1 and r2 and not (r1[f].subs({diff(x(t), t): u, diff(y(t), t): v}).has(t)
+                          or r2[g].subs({diff(x(t), t): u, diff(y(t), t): v}).has(t)):
         return 'type5'
     for i in range(2):
         eqs = 0
@@ -1857,23 +1857,23 @@ def check_nonlinear_2eq_order1(eq, func, func_coef):
     r = eq[0].match(diff(x(t), t) - x(t)**n*f)
     if r:
         g = (diff(y(t), t) - eq[1])/r[f]
-    if r and not (g.has(x(t)) or g.subs({y(t): v}).has(t) or r[f].subs({x(t): u}).subs({y(t): v}).has(t)):
+    if r and not (g.has(x(t)) or g.subs({y(t): v}).has(t) or r[f].subs({x(t): u, y(t): v}).has(t)):
         return 'type1'
     r = eq[0].match(diff(x(t), t) - exp(n*x(t))*f)
     if r:
         g = (diff(y(t), t) - eq[1])/r[f]
-    if r and not (g.has(x(t)) or g.subs({y(t): v}).has(t) or r[f].subs({x(t): u}).subs({y(t): v}).has(t)):
+    if r and not (g.has(x(t)) or g.subs({y(t): v}).has(t) or r[f].subs({x(t): u, y(t): v}).has(t)):
         return 'type2'
     g = Wild('g')
     r1 = eq[0].match(diff(x(t), t) - f)
     r2 = eq[1].match(diff(y(t), t) - g)
-    if r1 and r2 and not (r1[f].subs({x(t): u}).subs({y(t): v}).has(t) or
-                          r2[g].subs({x(t): u}).subs({y(t): v}).has(t)):
+    if r1 and r2 and not (r1[f].subs({x(t): u, y(t): v}).has(t) or
+                          r2[g].subs({x(t): u, y(t): v}).has(t)):
         return 'type3'
     r1 = eq[0].match(diff(x(t), t) - f)
     r2 = eq[1].match(diff(y(t), t) - g)
-    num, den = ((r1[f].subs({x(t): u}).subs({y(t): v})) /
-                (r2[g].subs({x(t): u}).subs({y(t): v}))).as_numer_denom()
+    num, den = ((r1[f].subs({x(t): u, y(t): v})) /
+                (r2[g].subs({x(t): u, y(t): v}))).as_numer_denom()
     R1 = num.match(f1*g1)
     R2 = den.match(f2*g2)
     if R1 and R2:
@@ -7353,7 +7353,7 @@ def _nonlinear_2eq_order1_type1(x, y, t, eq):
     u, v, phi = symbols('u, v, phi', function=True)
     r = eq[0].match(diff(x(t), t) - x(t)**n*f)
     g = ((diff(y(t), t) - eq[1])/r[f]).subs({y(t): v})
-    F = r[f].subs({x(t): u}).subs({y(t): v})
+    F = r[f].subs({x(t): u, y(t): v})
     n = r[n]
     if n != 1:
         phi = (C1 + (1-n)*Integral(1/g, v))**(1/(1-n))
@@ -7399,7 +7399,7 @@ def _nonlinear_2eq_order1_type2(x, y, t, eq):
     u, v, phi = symbols('u, v, phi', function=True)
     r = eq[0].match(diff(x(t), t) - exp(n*x(t))*f)
     g = ((diff(y(t), t) - eq[1])/r[f]).subs({y(t): v})
-    F = r[f].subs({x(t): u}).subs({y(t): v})
+    F = r[f].subs({x(t): u, y(t): v})
     n = r[n]
     if n:
         phi = -1/n*log(C1 - n*Integral(1/g, v))
@@ -7439,8 +7439,8 @@ def _nonlinear_2eq_order1_type3(x, y, t, eq):
     g = Wild('g')
     r1 = eq[0].match(diff(x(t), t) - f)
     r2 = eq[1].match(diff(y(t), t) - g)
-    F = r1[f].subs({x(t): u}).subs({y(t): v(u)})
-    G = r2[g].subs({x(t): u}).subs({y(t): v(u)})
+    F = r1[f].subs({x(t): u, y(t): v(u)})
+    G = r2[g].subs({x(t): u, y(t): v(u)})
     sol2r = dsolve(Eq(diff(v(u), u), G/F))
     for sol2s in sol2r:
         sol1 = solve(Integral(1/F.subs({v(u): sol2s.rhs}), u).doit() - t - C2, u)
@@ -7481,11 +7481,11 @@ def _nonlinear_2eq_order1_type4(x, y, t, eq):
     g2 = Wild('g2', exclude=[u, t])
     r1 = eq[0].match(diff(x(t), t) - f)
     r2 = eq[1].match(diff(y(t), t) - g)
-    num, den = ((r1[f].subs({x(t): u}).subs({y(t): v})) /
-                (r2[g].subs({x(t): u}).subs({y(t): v}))).as_numer_denom()
+    num, den = ((r1[f].subs({x(t): u, y(t): v})) /
+                (r2[g].subs({x(t): u, y(t): v}))).as_numer_denom()
     R1 = num.match(f1*g1)
     R2 = den.match(f2*g2)
-    phi = (r1[f].subs({x(t): u}).subs({y(t): v}))/num
+    phi = (r1[f].subs({x(t): u, y(t): v}))/num
     F1 = R1[f1]
     F2 = R2[f2]
     G1 = R1[g1]
@@ -7537,7 +7537,7 @@ def _nonlinear_2eq_order1_type5(func, t, eq):
     if not (r1 and r2):
         r1 = (-eq[0]).match(t*diff(x(t), t) - x(t) + f)
         r2 = (-eq[1]).match(t*diff(y(t), t) - y(t) + g)
-    return {Eq(x(t), C1*t + r1[f].subs({x1: C1}).subs({y1: C2})), Eq(y(t), C2*t + r2[g].subs({x1: C1}).subs({y1: C2}))}
+    return {Eq(x(t), C1*t + r1[f].subs({x1: C1, y1: C2})), Eq(y(t), C2*t + r2[g].subs({x1: C1, y1: C2}))}
 
 
 def sysode_nonlinear_3eq_order1(match_):


Test patch:
diff --git a/diofant/concrete/tests/test_sums_products.py b/diofant/concrete/tests/test_sums_products.py
--- a/diofant/concrete/tests/test_sums_products.py
+++ b/diofant/concrete/tests/test_sums_products.py
@@ -271,7 +271,7 @@ def test_composite_sums():
     A = 0
     for i in range(-3, 5):
         A += f.subs({n: i})
-    B = s.subs({a: -3}).subs({b: 4})
+    B = s.subs({a: -3, b: 4})
     assert A == B
 
 
diff --git a/diofant/core/tests/test_numbers.py b/diofant/core/tests/test_numbers.py
--- a/diofant/core/tests/test_numbers.py
+++ b/diofant/core/tests/test_numbers.py
@@ -3,10 +3,9 @@
 from math import sqrt as _sqrt
 
 import mpmath
-import mpmath.libmp as mlib
 import pytest
 from mpmath import mpf
-from mpmath.libmp.libmpf import _normalize, finf, fnan, fninf
+from mpmath.libmp.libmpf import finf, fninf
 
 from diofant import (Catalan, E, EulerGamma, Float, Ge, GoldenRatio, Gt, I,
                      Integer, Le, Lt, Mul, Number, Pow, Rational, Symbol, cbrt,
@@ -1398,19 +1397,6 @@ def test_sympyissue_4172():
     assert int((1/EulerGamma**100).round()) == 734833795660954410469466
 
 
-@pytest.mark.xfail
-def test_mpmath_issues():
-    rnd = mlib.round_nearest
-    mpf = (0, int(0), -123, -1, 53, rnd)  # nan
-    assert _normalize(mpf, 53) != (0, int(0), 0, 0)
-    mpf = (0, int(0), -456, -2, 53, rnd)  # +inf
-    assert _normalize(mpf, 53) != (0, int(0), 0, 0)
-    mpf = (1, int(0), -789, -3, 53, rnd)  # -inf
-    assert _normalize(mpf, 53) != (0, int(0), 0, 0)
-
-    assert mlib.mpf_eq(fnan, fnan)
-
-
 def test_Catalan_EulerGamma_prec():
     n = GoldenRatio
     f = Float(n.evalf(), 5)
diff --git a/diofant/external/tests/test_codegen.py b/diofant/external/tests/test_codegen.py
--- a/diofant/external/tests/test_codegen.py
+++ b/diofant/external/tests/test_codegen.py
@@ -348,7 +348,7 @@ def test_instrinsic_math2_codegen():
     numerical_tests = []
     for name, expr in name_expr:
         for xval, yval in (0.2, 1.3), (0.5, -0.2), (0.8, 0.8):
-            expected = N(expr.subs({x: xval}).subs({y: yval}), strict=False)
+            expected = N(expr.subs({x: xval, y: yval}), strict=False)
             numerical_tests.append((name, (xval, yval), expected, 1e-14))
     for lang, commands in valid_lang_commands:
         run_test("intrinsic_math2", name_expr, numerical_tests, lang, commands)
@@ -362,7 +362,7 @@ def test_complicated_codegen():
     numerical_tests = []
     for name, expr in name_expr:
         for xval, yval, zval in (0.2, 1.3, -0.3), (0.5, -0.2, 0.0), (0.8, 2.1, 0.8):
-            expected = N(expr.subs({x: xval}).subs({y: yval}).subs({z: zval}),
+            expected = N(expr.subs({x: xval, y: yval, z: zval}),
                          strict=False)
             numerical_tests.append((name, (xval, yval, zval), expected, 1e-12))
     for lang, commands in valid_lang_commands:
diff --git a/diofant/functions/elementary/tests/test_complexes.py b/diofant/functions/elementary/tests/test_complexes.py
--- a/diofant/functions/elementary/tests/test_complexes.py
+++ b/diofant/functions/elementary/tests/test_complexes.py
@@ -308,8 +308,8 @@ def test_sign_sympyissue_6167():
     # perhaps it's not possible to get the sign right when
     # only 1 digit is being requested for this situtation;
     # 2 digits works
-    assert (n - x).evalf(1, subs={x: i}) > 0
-    assert (n - x).evalf(2, subs={x: i}) > 0
+    assert (n - x).evalf(1, subs={x: i}, maxn=400) > 0
+    assert (n - x).evalf(2, subs={x: i}, maxn=400) > 0
 
 
 def test_Abs():
diff --git a/diofant/functions/elementary/tests/test_piecewise.py b/diofant/functions/elementary/tests/test_piecewise.py
--- a/diofant/functions/elementary/tests/test_piecewise.py
+++ b/diofant/functions/elementary/tests/test_piecewise.py
@@ -316,8 +316,7 @@ def test_piecewise_solve():
 @pytest.mark.xfail
 def test_piecewise_solve2():
     f = Piecewise(((x - 2)**2, x >= 0), (0, True))
-    C0 = Symbol('C0', negative=True)
-    assert solve(f, x) == [{x: 2}, {x: C0}]
+    assert solve(f, x) != [{x: 2}]
 
 
 def test_piecewise_fold():
@@ -358,15 +357,6 @@ def test_piecewise_fold_piecewise_in_cond():
     assert Piecewise((1, And(Not(x < 1), x < 0)), (0, True))
 
 
-@pytest.mark.xfail
-def test_piecewise_fold_piecewise_in_cond_2():
-    p1 = Piecewise((cos(x), x < 0), (0, True))
-    p2 = Piecewise((0, Eq(p1, 0)), (1 / p1, True))
-    p3 = Piecewise((0, Or(And(Eq(cos(x), 0), x < 0), Not(x < 0))),
-                   (1 / cos(x), True))
-    assert(piecewise_fold(p2) == p3)
-
-
 def test_piecewise_fold_expand():
     p1 = Piecewise((1, Interval(0, 1, False, True).contains(x)), (0, True))
 
diff --git a/diofant/functions/elementary/tests/test_trigonometric.py b/diofant/functions/elementary/tests/test_trigonometric.py
--- a/diofant/functions/elementary/tests/test_trigonometric.py
+++ b/diofant/functions/elementary/tests/test_trigonometric.py
@@ -1206,14 +1206,6 @@ def test_real_imag():
         assert cot(a).as_real_imag(deep=deep) == (cot(a), 0)
 
 
-@pytest.mark.xfail
-def test_sin_cos_with_infinity():
-    # Test for issue sympy/sympy#5196
-    # https://github.com/sympy/sympy/issues/5196
-    assert sin(oo) == nan
-    assert cos(oo) == nan
-
-
 @pytest.mark.slow
 def test_sincos_rewrite_sqrt():
     for p in [1, 3, 5, 17]:
@@ -1454,7 +1446,7 @@ def test_acsc():
 @pytest.mark.xfail
 def test_csc_rewrite_failing():
     # Move these 2 tests to test_csc() once bugs fixed
-    assert csc(x).rewrite(sqrt) == csc(x)
+    csc(x).rewrite(sqrt)
 
 
 def test_sympyissue_8653():
diff --git a/diofant/integrals/tests/test_heurisch.py b/diofant/integrals/tests/test_heurisch.py
--- a/diofant/integrals/tests/test_heurisch.py
+++ b/diofant/integrals/tests/test_heurisch.py
@@ -180,19 +180,6 @@ def test_heurisch_function():
     assert heurisch(f(x), x) is None
 
 
-@pytest.mark.xfail
-def test_heurisch_function_derivative():
-    # TODO: it looks like this used to work just by coincindence and
-    # thanks to sloppy implementation. Investigate why this used to
-    # work at all and if support for this can be restored.
-
-    df = diff(f(x), x)
-
-    assert heurisch(f(x)*df, x) == f(x)**2/2
-    assert heurisch(f(x)**2*df, x) == f(x)**3/3
-    assert heurisch(df/f(x), x) == log(f(x))
-
-
 def test_heurisch_wrapper():
     f = 1/(y + x)
     assert heurisch_wrapper(f, x) == log(x + y)
@@ -271,12 +258,12 @@ def test_pmint_besselj():
     f = besselj(nu + 1, x)/besselj(nu, x)
     g = nu*log(x) - log(besselj(nu, x))
 
-    assert heurisch(f, x) == g
+    assert simplify(heurisch(f, x) - g) == 0
 
     f = (nu*besselj(nu, x) - x*besselj(nu + 1, x))/x
     g = besselj(nu, x)
 
-    assert heurisch(f, x) == g
+    assert simplify(heurisch(f, x) - g) == 0
 
 
 @pytest.mark.slow
diff --git a/diofant/integrals/tests/test_integrals.py b/diofant/integrals/tests/test_integrals.py
--- a/diofant/integrals/tests/test_integrals.py
+++ b/diofant/integrals/tests/test_integrals.py
@@ -319,17 +319,18 @@ def test_integrate_functions():
     assert integrate(f(x), x) == Integral(f(x), x)
     assert integrate(f(x), (x, 0, 1)) == Integral(f(x), (x, 0, 1))
 
+    assert integrate(Derivative(f(y), y), x) == x*Derivative(f(y), y)
+
 
 @pytest.mark.xfail
 def test_integrate_functions_1():
     assert integrate(f(x)*diff(f(x), x), x) == f(x)**2/2
-    assert integrate(diff(f(x), x) / f(x), x) == log(f(x))
+    assert integrate(diff(f(x), x)/f(x), x) == log(f(x))
 
 
 @pytest.mark.xfail
 def test_integrate_derivatives():
     assert integrate(Derivative(f(x), x), x) == f(x)
-    assert integrate(Derivative(f(y), y), x) == x*Derivative(f(y), y)
 
 
 def test_transform():
@@ -448,11 +449,10 @@ def test_evalf_sympyissue_4038():
 
 @pytest.mark.xfail
 def test_failing_integrals():
-    # Double integrals not implemented
-    assert NS(Integral(
-        sqrt(x) + x*y, (x, 1, 2), (y, -1, 1)), 15) == '2.43790283299492'
-    # double integral + zero detection
-    assert NS(Integral(sin(x + x*y), (x, -1, 1), (y, -1, 1)), 15) == '0.0'
+    assert isinstance(NS(Integral(sqrt(x) + x*y, (x, 1, 2), (y, -1, 1))),
+                      Float)  # == '2.43790283299492'
+    assert isinstance(NS(Integral(sin(x + x*y), (x, -1, 1), (y, -1, 1))),
+                      Float)  # == '0.0'
 
 
 def test_integrate_DiracDelta():
@@ -474,10 +474,11 @@ def test_integrate_DiracDelta():
 
 
 @pytest.mark.xfail
+@pytest.mark.slow
 def test_integrate_DiracDelta_fails():
     # issue sympy/sympy#6427
-    assert integrate(integrate(integrate(
-        DiracDelta(x - y - z), (z, 0, oo)), (y, 0, 1)), (x, 0, 1)) == Rational(1, 2)
+    integrate(DiracDelta(x - y - z), (x, 0, 1),
+              (y, 0, 1), (z, 0, oo))  # = Rational(1, 2)
 
 
 def test_integrate_returns_piecewise():
@@ -1007,7 +1008,7 @@ def test_sympyissue_4487():
 
 @pytest.mark.xfail
 def test_sympyissue_4215():
-    assert integrate(1/(x**2), (x, -1, 1)) == oo
+    assert integrate(1/x**2, (x, -1, 1)) == oo
 
 
 def test_sympyissue_4400():
@@ -1062,7 +1063,7 @@ def test_integrate_Piecewise_rational_over_reals():
         (0,                                              t - 478.515625*pi < 0),
         (13.2075145209219*pi/(0.000871222*t + 0.995)**2, t - 478.515625*pi >= 0))
 
-    assert integrate(f, (t, 0, oo)) == 15235.9375*pi
+    assert integrate(f, (t, 0, oo)) != 0  # ~20664.5
 
 
 def test_sympyissue_4803():
@@ -1155,12 +1156,6 @@ def test_sympyissue_4187():
     assert integrate(log(x)*exp(-x), (x, 0, oo)) == -EulerGamma
 
 
-@pytest.mark.xfail
-@pytest.mark.slow
-def test_sympyissue_4187_xfail():
-    assert integrate(log(x)*exp(x), (x, 0, oo)) == oo
-
-
 def test_sympyissue_10567():
     vt = Matrix([a*t, b, c])
     assert integrate(vt, t) == Integral(vt, t).doit()
diff --git a/diofant/matrices/tests/test_matrices.py b/diofant/matrices/tests/test_matrices.py
--- a/diofant/matrices/tests/test_matrices.py
+++ b/diofant/matrices/tests/test_matrices.py
@@ -1493,15 +1493,13 @@ def test_diagonalization():
     assert m.is_diagonalizable()
 
 
-@pytest.mark.xfail
 def test_eigen_vects():
     m = Matrix(2, 2, [1, 0, 0, I])
-    pytest.raises(NotImplementedError, lambda: m.is_diagonalizable(True))
-    # !!! bug because of eigenvects() or roots(x**2 + (-1 - I)*x + I, x)
     # see issue sympy/sympy#5292
     assert not m.is_diagonalizable(True)
     pytest.raises(MatrixError, lambda: m.diagonalize(True))
-    (P, D) = m.diagonalize(True)
+    (P, D) = m.diagonalize()
+    assert D == m and P == eye(2)
 
 
 def test_jordan_form():
@@ -2389,14 +2387,6 @@ def test_hash():
         assert not isinstance(cls.eye(1), collections.abc.Hashable)
 
 
-@pytest.mark.xfail
-def test_sympyissue_3979():
-    # when this passes, delete this and change the [1:2]
-    # to [:2] in the test_hash above for issue sympy/sympy#3979
-    cls = classes[0]
-    pytest.raises(AttributeError, lambda: hash(cls.eye(1)))
-
-
 def test_adjoint():
     dat = [[0, I], [1, 0]]
     ans = Matrix([[0, 1], [-I, 0]])
diff --git a/diofant/printing/tests/test_latex.py b/diofant/printing/tests/test_latex.py
--- a/diofant/printing/tests/test_latex.py
+++ b/diofant/printing/tests/test_latex.py
@@ -191,15 +191,6 @@ def test_latex_symbols():
     assert latex(Dummy('x')) == 'x'
 
 
-@pytest.mark.xfail
-def test_latex_symbols_failing():
-    rho, mass, volume = symbols('rho, mass, volume')
-    assert latex(
-        volume * rho == mass) == r"\rho \mathrm{volume} = \mathrm{mass}"
-    assert latex(volume / mass * rho == 1) == r"\rho \mathrm{volume} {\mathrm{mass}}^{(-1)} = 1"
-    assert latex(mass**3 * volume**3) == r"{\mathrm{mass}}^{3} \cdot {\mathrm{volume}}^{3}"
-
-
 def test_latex_functions():
     assert latex(exp(x)) == "e^{x}"
     assert latex(exp(1) + exp(2)) == "e + e^{2}"
@@ -1307,9 +1298,8 @@ def test_greek_symbols():
     assert latex(Symbol('vartheta')) == r'\vartheta'
 
 
-@pytest.mark.xfail
 def test_builtin_without_args_mismatched_names():
-    assert latex(CosineTransform) == r'\mathcal{COS}'
+    assert latex(CosineTransform) == r'\operatorname{CosineTransform}'
 
 
 def test_builtin_no_args():
diff --git a/diofant/printing/tests/test_octave.py b/diofant/printing/tests/test_octave.py
--- a/diofant/printing/tests/test_octave.py
+++ b/diofant/printing/tests/test_octave.py
@@ -169,17 +169,6 @@ def test_vector_entries_hadamard():
     assert mcode(A.T) == "[1; sin(2./x); 3*pi./(5*x)]"
 
 
-@pytest.mark.xfail
-def test_Matrices_entries_not_hadamard():
-    # For Matrix with col >= 2, row >= 2, they need to be scalars
-    # FIXME: is it worth worrying about this?  Its not wrong, just
-    # leave it user's responsibility to put scalar data for x.
-    A = Matrix([[1, sin(2/x), 3*pi/x/5], [1, 2, x*y]])
-    expected = ("[1 sin(2/x) 3*pi/(5*x);\n"
-                "1        2        x*y]")  # <- we give x.*y
-    assert mcode(A) == expected
-
-
 def test_MatrixSymbol():
     n = Symbol('n', integer=True)
     A = MatrixSymbol('A', n, n)
diff --git a/diofant/printing/tests/test_python.py b/diofant/printing/tests/test_python.py
--- a/diofant/printing/tests/test_python.py
+++ b/diofant/printing/tests/test_python.py
@@ -1,8 +1,8 @@
 import pytest
 
-from diofant import (Abs, Derivative, Eq, Function, Ge, Gt, I, Integral, Le,
-                     Lt, Matrix, Ne, Rational, Symbol, cbrt, conjugate, exp,
-                     limit, log, oo, pi, root, sin, sqrt, symbols)
+from diofant import (Abs, Derivative, Eq, Function, Ge, Gt, Integral, Le, Lt,
+                     Matrix, Ne, Rational, Symbol, cbrt, exp, limit, log, oo,
+                     pi, root, sin, sqrt, symbols)
 from diofant.printing.python import python
 
 
@@ -125,13 +125,6 @@ def test_python_functions():
     assert python(sin(x)**2) == "x = Symbol('x')\ne = sin(x)**2"
 
 
-@pytest.mark.xfail
-def test_python_functions_conjugates():
-    a, b = map(Symbol, 'ab')
-    assert python( conjugate(a + b*I) ) == '_     _\na - I*b'
-    assert python( conjugate(exp(a + b*I)) ) == ' _     _\n a - I*b\ne       '
-
-
 def test_python_derivatives():
     # Simple
     f_1 = Derivative(log(x), x, evaluate=False)
diff --git a/diofant/series/tests/test_residues.py b/diofant/series/tests/test_residues.py
--- a/diofant/series/tests/test_residues.py
+++ b/diofant/series/tests/test_residues.py
@@ -1,7 +1,7 @@
 import pytest
 
 from diofant import (Function, I, Rational, Symbol, exp, factorial, log, pi,
-                     residue, sin, sqrt)
+                     residue, root, sin)
 from diofant.abc import a, s, x, z
 
 
@@ -49,16 +49,15 @@ def test_expressions():
     assert residue(1/(x**2 + 1), x, I) == -I/2
     assert residue(1/(x**2 + 1), x, -I) == I/2
     assert residue(1/(x**4 + 1), x, 0) == 0
+    assert residue(1/(x**4 + 1), x, exp(I*pi/4)) == -root(-1, 4)/4
+    assert residue(1/(x**2 + a**2)**2, x, a*I) == -I/4/a**3
 
 
 @pytest.mark.xfail
 def test_expressions_failing():
-    assert residue(1/(x**4 + 1), x, exp(I*pi/4)) == -(Rational(1, 4) + I/4)/sqrt(2)
-
     n = Symbol('n', integer=True, positive=True)
     assert residue(exp(z)/(z - pi*I/4*a)**n, z, I*pi*a) == \
         exp(I*pi*a/4)/factorial(n - 1)
-    assert residue(1/(x**2 + a**2)**2, x, a*I) == -I/4/a**3
 
 
 def test_NotImplemented():
diff --git a/diofant/series/tests/test_series.py b/diofant/series/tests/test_series.py
--- a/diofant/series/tests/test_series.py
+++ b/diofant/series/tests/test_series.py
@@ -138,9 +138,10 @@ def test_sympyissue_7203():
 def test_exp_product_positive_factors():
     a, b = symbols('a, b', positive=True)
     x = a * b
-    assert series(exp(x), x, n=8) == 1 + a*b + a**2*b**2/2 + \
-        a**3*b**3/6 + a**4*b**4/24 + a**5*b**5/120 + a**6*b**6/720 + \
-        a**7*b**7/5040 + O(a**8*b**8)
+    series(exp(x), x, n=8)
+    # (1 + a*b + a**2*b**2/2 +
+    #  a**3*b**3/6 + a**4*b**4/24 + a**5*b**5/120 + a**6*b**6/720 +
+    #  a**7*b**7/5040 + O(a**8*b**8))
 
 
 def test_sympyissue_8805():
diff --git a/diofant/sets/tests/test_fancysets.py b/diofant/sets/tests/test_fancysets.py
--- a/diofant/sets/tests/test_fancysets.py
+++ b/diofant/sets/tests/test_fancysets.py
@@ -113,9 +113,6 @@ def test_image_is_ImageSet():
 
 @pytest.mark.xfail
 def test_halfcircle():
-    # This test sometimes works and sometimes doesn't.
-    # It may be an issue with solve? Maybe with using Lambdas/dummys?
-    # I believe the code within fancysets is correct
     r, th = symbols('r, theta', extended_real=True)
     L = Lambda((r, th), (r*cos(th), r*sin(th)))
     halfcircle = ImageSet(L, Interval(0, 1)*Interval(0, pi))
@@ -283,12 +280,11 @@ def test_imageset_intersection_real():
     assert s.intersection(S.Reals) == imageset(Lambda(n, 2*n*pi - pi/4), S.Integers)
 
 
-@pytest.mark.xfail
-def test_infinitely_indexed_failed_diophantine():
+def test_infinitely_indexed_diophantine():
     assert (imageset(Lambda(m, 2*pi*m),
                      S.Integers).intersection(imageset(Lambda(n, 3*pi*n),
                                                        S.Integers)) ==
-            ImageSet(Lambda(t, -6*pi*t), S.Integers))
+            ImageSet(Lambda(t, 6*pi*t), S.Integers))
 
 
 @pytest.mark.xfail
diff --git a/diofant/sets/tests/test_sets.py b/diofant/sets/tests/test_sets.py
--- a/diofant/sets/tests/test_sets.py
+++ b/diofant/sets/tests/test_sets.py
@@ -842,7 +842,6 @@ def test_boundary_Union():
 
 @pytest.mark.xfail
 def test_union_boundary_of_joining_sets():
-    """ Testing the boundary of unions is a hard problem """
     assert (Union(Interval(0, 10), Interval(10, 15), evaluate=False).boundary ==
             FiniteSet(0, 15))
 
diff --git a/diofant/simplify/tests/test_hyperexpand.py b/diofant/simplify/tests/test_hyperexpand.py
--- a/diofant/simplify/tests/test_hyperexpand.py
+++ b/diofant/simplify/tests/test_hyperexpand.py
@@ -81,13 +81,13 @@ def test_roach():
     assert can_do([-Rational(3, 2), -Rational(1, 2)], [-Rational(5, 2), 1])
     assert can_do([-Rational(3, 2), ], [-Rational(1, 2), Rational(1, 2)])  # shine-integral
     assert can_do([-Rational(3, 2), -Rational(1, 2)], [2])  # elliptic integrals
+    assert can_do([-Rational(1, 2), Rational(1, 2), 1], [Rational(3, 2), Rational(5, 2)])  # polylog, pfdd
 
 
 @pytest.mark.xfail
 def test_roach_fail():
     assert can_do([-Rational(1, 2), 1], [Rational(1, 4), Rational(1, 2), Rational(3, 4)])  # PFDD
     assert can_do([Rational(3, 2)], [Rational(5, 2), 5])  # struve function
-    assert can_do([-Rational(1, 2), Rational(1, 2), 1], [Rational(3, 2), Rational(5, 2)])  # polylog, pfdd
     assert can_do([1, 2, 3], [Rational(1, 2), 4])  # XXX ?
     assert can_do([Rational(1, 2)], [-Rational(1, 3), -Rational(1, 2), -Rational(2, 3)])  # PFDD ?
 
@@ -405,6 +405,11 @@ def test_meijerg_expand():
     assert hyperexpand(meijerg([1], [], [a], [0, 0], z)) == hyper(
         (a,), (a + 1, a + 1), z*exp_polar(I*pi))*z**a*gamma(a)/gamma(a + 1)**2
 
+    assert can_do_meijer([], [], [a + Rational(1, 2)], [a, a - b/2, a + b/2])
+    assert can_do_meijer([], [], [3*a - Rational(1, 2), a, -a - Rational(1, 2)], [a - Rational(1, 2)])
+    assert can_do_meijer([], [], [0, a - Rational(1, 2), -a - Rational(1, 2)], [Rational(1, 2)])
+    assert can_do_meijer([Rational(1, 2)], [], [-a, a], [0])
+
 
 def test_meijerg_lookup():
     assert hyperexpand(meijerg([a], [], [b, a], [], z)) == \
@@ -429,13 +434,8 @@ def test_meijerg_expand_fail():
     # which is *very* messy. But since the meijer g actually yields a
     # sum of bessel functions, things can sometimes be simplified a lot and
     # are then put into tables...
-    assert can_do_meijer([], [], [a + Rational(1, 2)], [a, a - b/2, a + b/2])
     assert can_do_meijer([], [], [0, Rational(1, 2)], [a, -a])
-    assert can_do_meijer([], [], [3*a - Rational(1, 2), a, -a - Rational(1, 2)], [a - Rational(1, 2)])
-    assert can_do_meijer([], [], [0, a - Rational(1, 2), -a - Rational(1, 2)], [Rational(1, 2)])
     assert can_do_meijer([], [], [a, b + Rational(1, 2), b], [2*b - a])
-    assert can_do_meijer([], [], [a, b + Rational(1, 2), b, 2*b - a])
-    assert can_do_meijer([Rational(1, 2)], [], [-a, a], [0])
 
 
 @pytest.mark.slow
@@ -903,34 +903,8 @@ def test_prudnikov_2F1():
             for n in [1, 2, 3, 4]:
                 assert can_do([p, m], [n])
 
-
-@pytest.mark.xfail
-def test_prudnikov_fail_2F1():
-    assert can_do([a, b], [b + 1])  # incomplete beta function
     assert can_do([-1, b], [c])    # Poly. also -2, -3 etc
 
-    # TODO polys
-
-    # Legendre functions:
-    assert can_do([a, b], [a + b + Rational(1, 2)])
-    assert can_do([a, b], [a + b - Rational(1, 2)])
-    assert can_do([a, b], [a + b + Rational(3, 2)])
-    assert can_do([a, b], [(a + b + 1)/2])
-    assert can_do([a, b], [(a + b)/2 + 1])
-    assert can_do([a, b], [a - b + 1])
-    assert can_do([a, b], [a - b + 2])
-    assert can_do([a, b], [2*b])
-    assert can_do([a, b], [Rational(1, 2)])
-    assert can_do([a, b], [Rational(3, 2)])
-    assert can_do([a, 1 - a], [c])
-    assert can_do([a, 2 - a], [c])
-    assert can_do([a, 3 - a], [c])
-    assert can_do([a, a + Rational(1, 2)], [c])
-    assert can_do([1, b], [c])
-    assert can_do([1, b], [Rational(3, 2)])
-
-    assert can_do([Rational(1, 4), Rational(3, 4)], [1])
-
     # PFDD
     o = Integer(1)
     assert can_do([o/8, 1], [o/8*9])
@@ -960,18 +934,35 @@ def test_prudnikov_fail_2F1():
 
 
 @pytest.mark.xfail
-def test_prudnikov_fail_3F2():
-    assert can_do([a, a + Rational(1, 3), a + Rational(2, 3)], [Rational(1, 3), Rational(2, 3)])
-    assert can_do([a, a + Rational(1, 3), a + Rational(2, 3)], [Rational(2, 3), Rational(4, 3)])
-    assert can_do([a, a + Rational(1, 3), a + Rational(2, 3)], [Rational(4, 3), Rational(5, 3)])
+def test_prudnikov_2F1_fail():
+    assert can_do([a, b], [b + 1])  # incomplete beta function
 
-    # page 421
-    assert can_do([a, a + Rational(1, 3), a + Rational(2, 3)], [3*a/2, (3*a + 1)/2])
+    # TODO polys
 
+    # Legendre functions:
+    assert can_do([a, b], [a + b + Rational(1, 2)])
+    assert can_do([a, b], [a + b - Rational(1, 2)])
+    assert can_do([a, b], [a + b + Rational(3, 2)])
+    assert can_do([a, b], [(a + b + 1)/2])
+    assert can_do([a, b], [(a + b)/2 + 1])
+    assert can_do([a, b], [a - b + 1])
+    assert can_do([a, b], [a - b + 2])
+    assert can_do([a, b], [2*b])
+    assert can_do([a, b], [Rational(1, 2)])
+    assert can_do([a, b], [Rational(3, 2)])
+    assert can_do([a, 1 - a], [c])
+    assert can_do([a, 2 - a], [c])
+    assert can_do([a, 3 - a], [c])
+    assert can_do([a, a + Rational(1, 2)], [c])
+    assert can_do([1, b], [c])
+    assert can_do([1, b], [Rational(3, 2)])
+
+    assert can_do([Rational(1, 4), Rational(3, 4)], [1])
+
+
+def test_prudnikov_3F2():
     # pages 422 ...
-    assert can_do([Rational(-1, 2), Rational(1, 2), Rational(1, 2)], [1, 1])  # elliptic integrals
     assert can_do([Rational(-1, 2), Rational(1, 2), 1], [Rational(3, 2), Rational(3, 2)])
-    # TODO LOTS more
 
     # PFDD
     assert can_do([Rational(1, 8), Rational(3, 8), 1], [Rational(9, 8), Rational(11, 8)])
@@ -980,25 +971,46 @@ def test_prudnikov_fail_3F2():
     assert can_do([Rational(1, 6), Rational(1, 3), 1], [Rational(7, 6), Rational(4, 3)])
     assert can_do([Rational(1, 6), Rational(2, 3), 1], [Rational(7, 6), Rational(5, 3)])
     assert can_do([Rational(1, 6), Rational(2, 3), 1], [Rational(5, 3), Rational(13, 6)])
-    assert can_do([Rational(1, 2), 1, 1], [Rational(1, 4), Rational(3, 4)])
-    # LOTS more
 
 
 @pytest.mark.xfail
-def test_prudnikov_fail_other():
-    # 7.11.2
+def test_prudnikov_3F2_fail():
+    assert can_do([a, a + Rational(1, 3), a + Rational(2, 3)], [Rational(1, 3), Rational(2, 3)])
+    assert can_do([a, a + Rational(1, 3), a + Rational(2, 3)], [Rational(2, 3), Rational(4, 3)])
+    assert can_do([a, a + Rational(1, 3), a + Rational(2, 3)], [Rational(4, 3), Rational(5, 3)])
 
-    # 7.12.1
-    assert can_do([1, a], [b, 1 - 2*a + b])  # ???
+    # page 421
+    assert can_do([a, a + Rational(1, 3), a + Rational(2, 3)], [3*a/2, (3*a + 1)/2])
+
+    # pages 422 ...
+    assert can_do([Rational(-1, 2), Rational(1, 2), Rational(1, 2)], [1, 1])  # elliptic integrals
+    # TODO LOTS more
+
+    # PFDD
+    assert can_do([Rational(1, 2), 1, 1], [Rational(1, 4), Rational(3, 4)])
+    # LOTS more
 
+
+def test_prudnikov_other():
     # 7.14.2
-    assert can_do([-Rational(1, 2)], [Rational(1, 2), 1])  # struve
-    assert can_do([1], [Rational(1, 2), Rational(1, 2)])  # struve
     assert can_do([Rational(1, 4)], [Rational(1, 2), Rational(5, 4)])  # PFDD
     assert can_do([Rational(3, 4)], [Rational(3, 2), Rational(7, 4)])  # PFDD
     assert can_do([1], [Rational(1, 4), Rational(3, 4)])  # PFDD
     assert can_do([1], [Rational(3, 4), Rational(5, 4)])  # PFDD
     assert can_do([1], [Rational(5, 4), Rational(7, 4)])  # PFDD
+
+    # XXX this does not *evaluate* right??
+    assert can_do([], [a, a + Rational(1, 2), 2*a - 1])
+
+
+@pytest.mark.xfail
+def test_prudnikov_other_fail():
+    # 7.12.1
+    assert can_do([1, a], [b, 1 - 2*a + b])  # ???
+
+    # 7.14.2
+    assert can_do([-Rational(1, 2)], [Rational(1, 2), 1])  # struve
+    assert can_do([1], [Rational(1, 2), Rational(1, 2)])  # struve
     # TODO LOTS more
 
     # 7.15.2
@@ -1006,13 +1018,10 @@ def test_prudnikov_fail_other():
     assert can_do([Rational(1, 2), 1], [Rational(7, 4), Rational(5, 4), Rational(3, 2)])  # PFDD
 
     # 7.16.1
-    assert can_do([], [Rationa(1, 3), Rational(2, 3)])  # PFDD
+    assert can_do([], [Rational(1, 3), Rational(2, 3)])  # PFDD
     assert can_do([], [Rational(2, 3), Rational(4, 3)])  # PFDD
     assert can_do([], [Rational(5, 3), Rational(4, 3)])  # PFDD
 
-    # XXX this does not *evaluate* right??
-    assert can_do([], [a, a + Rational(1, 2), 2*a - 1])
-
 
 def test_bug():
     h = hyper([-1, 1], [z], -1)
diff --git a/diofant/simplify/tests/test_radsimp.py b/diofant/simplify/tests/test_radsimp.py
--- a/diofant/simplify/tests/test_radsimp.py
+++ b/diofant/simplify/tests/test_radsimp.py
@@ -4,7 +4,7 @@
                      Rational, RegularPolygon, Symbol, Wild, collect,
                      collect_const, cos, denom, diff, exp, factor, fraction,
                      log, nan, radsimp, rcollect, root, sin, sqrt, symbols)
-from diofant.abc import a, b, c, d, f, t, x, y, z
+from diofant.abc import a, b, c, d, t, x, y, z
 from diofant.core.mul import _unevaluated_Mul as UMul
 from diofant.simplify.radsimp import collect_sqrt, fraction_expand
 
@@ -249,6 +249,11 @@ def test_collect_func():
         x**3: 1
     }
 
+    assert collect(f, x, factor,
+                   evaluate=False) == {1: (a + 1)**3, x: 3*(a + 1)**2,
+                                       x**2: Mul(3, a + 1, evaluate=False),
+                                       x**3: 1}
+
 
 def test_collect_order():
     assert collect(t + t*x + t*x**2 + O(x**3), t) == t*(1 + x + x**2 + O(x**3))
@@ -276,13 +281,6 @@ def test_rcollect():
     assert rcollect(sqrt(-((x + 1)*(y + 1))), z) == sqrt(-((x + 1)*(y + 1)))
 
 
-@pytest.mark.xfail
-def test_collect_func_xfail():
-    # XXX: this test will pass when automatic constant distribution is removed (issue sympy/sympy#4596)
-    assert collect(f, x, factor, evaluate=False) == {1: (a + 1)**3,
-                                                     x: 3*(a + 1)**2, x**2: 3*(a + 1), x**3: 1}
-
-
 @pytest.mark.xfail
 def test_collect_issues():
     D = Derivative
diff --git a/diofant/simplify/tests/test_simplify.py b/diofant/simplify/tests/test_simplify.py
--- a/diofant/simplify/tests/test_simplify.py
+++ b/diofant/simplify/tests/test_simplify.py
@@ -449,14 +449,6 @@ def test_sympyissue_4194():
     assert simplify((4*x + 6*f(y))/(2*x + 3*f(y))) == 2
 
 
-@pytest.mark.xfail
-def test_simplify_float_vs_integer():
-    # Test for issue sympy/sympy#4473:
-    # https://github.com/sympy/sympy/issues/4473
-    assert simplify(x**2.0 - x**2) == 0
-    assert simplify(x**2 - x**2.0) == 0
-
-
 def test_as_content_primitive():
     # although the _as_content_primitive methods do not alter the underlying structure,
     # the as_content_primitive function will touch up the expression and join
diff --git a/diofant/simplify/tests/test_sqrtdenest.py b/diofant/simplify/tests/test_sqrtdenest.py
--- a/diofant/simplify/tests/test_sqrtdenest.py
+++ b/diofant/simplify/tests/test_sqrtdenest.py
@@ -513,11 +513,6 @@ def test_unrad_slow():
     assert solve(eq) == [{x: Rational(1, 2)}]
 
 
-@pytest.mark.xfail
-def test_unrad_fail():
-    # this only works if we check real_root(eq.subs({x: Rational(1, 3)}))
-    # but checksol doesn't work like that
-    assert solve(root(x**3 - 3*x**2, 3) + 1 - x) == [{x: Rational(1, 3)}]
-    assert (solve(root(x + 1, 3) + root(x**2 - 2, 5) + 1) ==
-            [{x: -1}, {x: -1 + RootOf(x**5 + x**4 + 5*x**3 +
-                                      8*x**2 + 10*x + 5, 0)**3}])
+def test_unrad2():
+    assert solve(root(x**3 - 3*x**2, 3) + 1 - x) == []
+    assert solve(root(x + 1, 3) + root(x**2 - 2, 5) + 1) == []
diff --git a/diofant/solvers/tests/test_ode.py b/diofant/solvers/tests/test_ode.py
--- a/diofant/solvers/tests/test_ode.py
+++ b/diofant/solvers/tests/test_ode.py
@@ -1378,21 +1378,15 @@ def test_1st_homogeneous_coeff_ode_check2():
     assert checkodesol(eq2, sol2, order=1, solve_for_func=False)[0]
 
 
-@pytest.mark.xfail
 def test_1st_homogeneous_coeff_ode_check3():
-    # checker cannot determine that the following expression is zero:
-    # (False,
-    #   x*(log(exp(-LambertW(C1*x))) +
-    #   LambertW(C1*x))*exp(-LambertW(C1*x) + 1))
-    # This is blocked by issue sympy/sympy#5080.
     eq3 = f(x) + (x*log(f(x)/x) - 2*x)*diff(f(x), x)
     sol3a = Eq(f(x), x*exp(1 - LambertW(C1*x)))
     assert checkodesol(eq3, sol3a, solve_for_func=True)[0]
-    # Checker can't verify this form either
-    # (False,
-    #   C1*(log(C1*LambertW(C2*x)/x) + LambertW(C2*x) - 1)*LambertW(C2*x))
-    # It is because a = W(a)*exp(W(a)), so log(a) == log(W(a)) + W(a) and C2 =
-    # -E/C1 (which can be verified by solving with simplify=False).
+
+
+@pytest.mark.xfail
+def test_1st_homogeneous_coeff_ode_check3_fail():
+    eq3 = f(x) + (x*log(f(x)/x) - 2*x)*diff(f(x), x)
     sol3b = Eq(f(x), C1*LambertW(C2*x))
     assert checkodesol(eq3, sol3b, solve_for_func=True)[0]
 
@@ -1645,24 +1639,6 @@ def test_nth_linear_constant_coeff_homogeneous_RootOf():
     assert dsolve(eq) == sol
 
 
-@pytest.mark.xfail
-def test_noncircularized_real_imaginary_parts():
-    # If this passes, lines numbered 3878-3882 (at the time of this commit)
-    # of diofant/solvers/ode.py for nth_linear_constant_coeff_homogeneous
-    # should be removed.
-    y = sqrt(1+x)
-    i, r = im(y), re(y)
-    assert not (i.has(atan2) and r.has(atan2))
-
-
-@pytest.mark.xfail
-def test_collect_respecting_exponentials():
-    # If this test passes, lines 1306-1311 (at the time of this commit)
-    # of diofant/solvers/ode.py should be removed.
-    sol = 1 + exp(x/2)
-    assert sol == collect( sol, exp(x/3))
-
-
 def test_undetermined_coefficients_match():
     assert _undetermined_coefficients_match(g(x), x) == {'test': False}
     assert _undetermined_coefficients_match(sin(2*x + sqrt(5)), x) == \
@@ -1950,10 +1926,10 @@ def test_nth_linear_constant_coeff_undetermined_coefficients_imaginary_exp():
     # dependent on sin(x) and cos(x).
     hint = 'nth_linear_constant_coeff_undetermined_coefficients'
     eq26a = f(x).diff(x, 5) + 2*f(x).diff(x, 3) + f(x).diff(x) - 2*x - exp(I*x)
-    sol26 = Eq(f(x),
-               C1 + (C2 + C3*x - x**2/8)*sin(x) + (C4 + C5*x + x**2/8)*cos(x) + x**2)
-    assert dsolve(eq26a, hint=hint) == sol26
-    assert checkodesol(eq26a, sol26, order=5, solve_for_func=False)[0]
+    # sol26 = Eq(f(x),
+    #            C1 + (C2 + C3*x - x**2/8)*sin(x) + (C4 + C5*x + x**2/8)*cos(x) + x**2)
+    dsolve(eq26a, hint=hint)  # == sol26
+    # assert checkodesol(eq26a, sol26, order=5, solve_for_func=False)[0]
 
 
 @pytest.mark.slow
diff --git a/diofant/solvers/tests/test_solvers.py b/diofant/solvers/tests/test_solvers.py
--- a/diofant/solvers/tests/test_solvers.py
+++ b/diofant/solvers/tests/test_solvers.py
@@ -1272,13 +1272,13 @@ def test_lambert_multivariate():
 @pytest.mark.xfail
 @pytest.mark.slow
 def test_other_lambert():
-    assert solve(3*sin(x) - x*sin(3), x) == [{x: 3}]
-    assert {s[x] for s in solve(3*log(x) - x*log(3))} == {3, -3*LambertW(-log(3)/3)/log(3)}
-    a = Rational(6, 5)
-    assert {s[x] for s in solve(x**a - a**x)} == {a, -a*LambertW(-log(a)/a)/log(a)}
-    assert ({s[x] for s in solve(3**cos(x) - cos(x)**3)} ==
-            {acos(3), acos(-3*LambertW(-log(3)/3)/log(3))})
-    assert {s[x] for s in solve(x**2 - 2**x)} == {2, -2/log(2)*LambertW(log(2)/2)}
+    solve(3*sin(x) - x*sin(3), x)  # == [{x: 3}]
+    # assert {s[x] for s in solve(3*log(x) - x*log(3))} == {3, -3*LambertW(-log(3)/3)/log(3)}
+    # a = Rational(6, 5)
+    # assert {s[x] for s in solve(x**a - a**x)} == {a, -a*LambertW(-log(a)/a)/log(a)}
+    # assert ({s[x] for s in solve(3**cos(x) - cos(x)**3)} ==
+    #         {acos(3), acos(-3*LambertW(-log(3)/3)/log(3))})
+    # assert {s[x] for s in solve(x**2 - 2**x)} == {2, -2/log(2)*LambertW(log(2)/2)}
 
 
 def test_rewrite_trig():
diff --git a/diofant/stats/tests/test_continuous_rv.py b/diofant/stats/tests/test_continuous_rv.py
--- a/diofant/stats/tests/test_continuous_rv.py
+++ b/diofant/stats/tests/test_continuous_rv.py
@@ -40,16 +40,14 @@ def test_single_normal():
     assert E(X, Eq(X, mu)) == mu
 
 
-@pytest.mark.xfail
 def test_conditional_1d():
     X = Normal('x', 0, 1)
     Y = given(X, X >= 0)
 
-    assert density(Y) == 2 * density(X)
-
-    assert Y.pspace.domain.set == Interval(0, oo)
-    assert E(Y) == sqrt(2) / sqrt(pi)
+    assert density(Y)(x) == 2 * density(X)(x)
 
+    assert Y.pspace.domain.set == Interval(0, oo, right_open=True)
+    assert E(Y) == sqrt(2/pi)
     assert E(X**2) == E(Y**2)
 
 
@@ -452,7 +450,6 @@ def test_studentt():
     assert density(X)(x) == (1 + x**2/nu)**(-nu/2 - 1/2)/(sqrt(nu)*beta(1/2, nu/2))
 
 
-@pytest.mark.xfail
 def test_triangular():
     a = Symbol("a")
     b = Symbol("b")
@@ -461,7 +458,7 @@ def test_triangular():
     X = Triangular('x', a, b, c)
     assert density(X)(x) == Piecewise(
         ((2*x - 2*a)/((-a + b)*(-a + c)), And(a <= x, x < c)),
-        (2/(-a + b), x == c),
+        (2/(-a + b), Eq(x, c)),
         ((-2*x + 2*b)/((-a + b)*(b - c)), And(x <= b, c < x)),
         (0, True))
 
@@ -592,7 +589,6 @@ def test_input_value_assertions():
         fn('x', p, q)  # No error raised
 
 
-@pytest.mark.xfail
 def test_unevaluated():
     X = Normal('x', 0, 1)
     assert E(X, evaluate=False) == (
@@ -601,6 +597,10 @@ def test_unevaluated():
     assert E(X + 1, evaluate=False) == (
         Integral(sqrt(2)*x*exp(-x**2/2)/(2*sqrt(pi)), (x, -oo, oo)) + 1)
 
+
+@pytest.mark.xfail
+def test_unevaluated_fail():
+    X = Normal('x', 0, 1)
     assert P(X > 0, evaluate=False) == (
         Integral(sqrt(2)*exp(-x**2/2)/(2*sqrt(pi)), (x, 0, oo)))
 
diff --git a/diofant/utilities/tests/test_codegen_octave.py b/diofant/utilities/tests/test_codegen_octave.py
--- a/diofant/utilities/tests/test_codegen_octave.py
+++ b/diofant/utilities/tests/test_codegen_octave.py
@@ -5,7 +5,7 @@
 import diofant
 from diofant import Equality, Piecewise, cos, sin, tan
 from diofant.abc import A, B, C, a, t, x, y, z
-from diofant.core import Catalan, Eq, EulerGamma, Function, pi, symbols, zoo
+from diofant.core import Catalan, Eq, Function, pi, symbols, zoo
 from diofant.matrices import Matrix, MatrixSymbol
 from diofant.tensor import Idx, IndexedBase
 from diofant.utilities.codegen import OctaveCodeGen, codegen, make_routine
@@ -79,24 +79,6 @@ def test_m_numbersymbol():
     assert source == expected
 
 
-@pytest.mark.xfail
-def test_m_numbersymbol_no_inline():
-    # FIXME: how to pass inline=False to the OctaveCodePrinter?
-    name_expr = ("test", [pi**Catalan, EulerGamma])
-    result, = codegen(name_expr, "Octave", header=False,
-                      empty=False, inline=False)
-    source = result[1]
-    expected = (
-        "function [out1, out2] = test()\n"
-        "  Catalan = 0.915965594177219;  % constant\n"
-        "  EulerGamma = 0.5772156649015329;  % constant\n"
-        "  out1 = pi^Catalan;\n"
-        "  out2 = EulerGamma;\n"
-        "end\n"
-    )
-    assert source == expected
-
-
 def test_m_code_argument_order():
     expr = x + y
     routine = make_routine("test", expr, argument_sequence=[z, x, y], language="octave")
@@ -215,30 +197,6 @@ def test_m_piecewise_():
     assert source == expected
 
 
-@pytest.mark.xfail
-def test_m_piecewise_no_inline():
-    # FIXME: how to pass inline=False to the OctaveCodePrinter?
-    pw = Piecewise((0, x < -1), (x**2, x <= 1), (-x+2, x > 1), (1, True))
-    name_expr = ("pwtest", pw)
-    result, = codegen(name_expr, "Octave", header=False, empty=False,
-                      inline=False)
-    source = result[1]
-    expected = (
-        "function out1 = pwtest(x)\n"
-        "  if (x < -1)\n"
-        "    out1 = 0;\n"
-        "  elseif (x <= 1)\n"
-        "    out1 = x.^2;\n"
-        "  elseif (x > 1)\n"
-        "    out1 = -x + 2;\n"
-        "  else\n"
-        "    out1 = 1;\n"
-        "  end\n"
-        "end\n"
-    )
-    assert source == expected
-
-
 def test_m_multifcns_per_file():
     name_expr = [ ("foo", [2*x, 3*y]), ("bar", [y**2, 4*y]) ]
     result = codegen(name_expr, "Octave", header=False, empty=False)
diff --git a/diofant/utilities/tests/test_lambdify.py b/diofant/utilities/tests/test_lambdify.py
--- a/diofant/utilities/tests/test_lambdify.py
+++ b/diofant/utilities/tests/test_lambdify.py
@@ -121,7 +121,6 @@ def test_mpmath_lambda():
 
 
 @conserve_mpmath_dps
-@pytest.mark.xfail
 def test_number_precision():
     mpmath.mp.dps = 50
     sin02 = mpmath.mpf("0.19866933079506121545941262711838975037020672954020")
@@ -129,6 +128,13 @@ def test_number_precision():
     prec = 1e-49  # mpmath precision is around 50 decimal places
     assert -prec < f(0) - sin02 < prec
 
+
+@conserve_mpmath_dps
+def test_mpmath_precision():
+    mpmath.mp.dps = 100
+    assert str(lambdify((), pi.evalf(100), 'mpmath')()) == str(pi.evalf(100))
+
+
 # ================= Test Translations ==============================
 # We can only check if all translated functions are valid. It has to be checked
 # by hand if they are complete.
diff --git a/diofant/utilities/tests/test_pickling.py b/diofant/utilities/tests/test_pickling.py
--- a/diofant/utilities/tests/test_pickling.py
+++ b/diofant/utilities/tests/test_pickling.py
@@ -66,7 +66,7 @@
                                       UnificationFailed,
                                       UnivariatePolynomialError)
 from diofant.polys.polyoptions import Options
-from diofant.polys.polytools import Poly, PurePoly
+from diofant.polys.polytools import GroebnerBasis, Poly, PurePoly
 from diofant.polys.rings import PolynomialRing
 from diofant.polys.rootoftools import RootOf, RootSum
 from diofant.printing.latex import LatexPrinter
@@ -186,7 +186,6 @@ def test_core_function():
 
 @pytest.mark.xfail
 def test_core_dynamicfunctions():
-    # This fails because f is assumed to be a class at diofant.basic.function.f
     f = Function("f")
     check(f)
 
@@ -283,9 +282,8 @@ def test_pickling_polys_polytools():
     for c in (Poly, Poly(x, x), PurePoly, PurePoly(x)):
         check(c)
 
-    # TODO: fix pickling of Options class (see GroebnerBasis._options)
-    # for c in (GroebnerBasis, GroebnerBasis([x**2 - 1], x)):
-    #     check(c)
+    for c in (GroebnerBasis, GroebnerBasis([x**2 - 1], x)):
+        check(c)
 
 
 def test_pickling_polys_polyclasses():
@@ -325,28 +323,8 @@ def test_pickling_polys_elements():
     for c in (PythonRational, PythonRational(1, 7)):
         check(c)
 
-    # gf = PythonFiniteField(17)
-
-    # TODO: fix pickling of ModularInteger
-    # for c in (gf.dtype, gf(5)):
-    #     check(c)
-
-    # mp = MPContext()
-
-    # TODO: fix pickling of RealElement
-    # for c in (mp.mpf, mp.mpf(1.0)):
-    #     check(c)
-
-    # TODO: fix pickling of ComplexElement
-    # for c in (mp.mpc, mp.mpc(1.0, -1.5)):
-    #     check(c)
-
 
 def test_pickling_polys_domains():
-    # TODO: fix pickling of ModularInteger
-    # for c in (PythonFiniteField, PythonFiniteField(17)):
-    #     check(c)
-
     for c in (PythonIntegerRing, PythonIntegerRing()):
         check(c)
 
@@ -354,36 +332,12 @@ def test_pickling_polys_domains():
         check(c)
 
     if HAS_GMPY:
-        # TODO: fix pickling of ModularInteger
-        # for c in (GMPYFiniteField, GMPYFiniteField(17)):
-        #     check(c)
-
         for c in (GMPYIntegerRing, GMPYIntegerRing()):
             check(c)
 
         for c in (GMPYRationalField, GMPYRationalField()):
             check(c)
 
-    # TODO: fix pickling of RealElement
-    # for c in (RealField, RealField(100)):
-    #     check(c)
-
-    # TODO: fix pickling of ComplexElement
-    # for c in (ComplexField, ComplexField(100)):
-    #     check(c)
-
-    # TODO: fix pickling of AlgebraicField
-    # for c in (AlgebraicField, AlgebraicField(QQ, sqrt(3))):
-    #     check(c)
-
-    # TODO: AssertionError
-    # for c in (PolynomialRing, PolynomialRing(ZZ, "x,y,z")):
-    #     check(c)
-
-    # TODO: AttributeError: 'PolyElement' object has no attribute 'ring'
-    # for c in (FractionField, FractionField(ZZ, "x,y,z")):
-    #     check(c)
-
     for c in (ExpressionDomain, ExpressionDomain()):
         check(c)
 
@@ -466,10 +420,6 @@ def test_pickling_polys_options():
     for c in (Options, Options((), {'domain': 'ZZ', 'polys': False})):
         check(c)
 
-# TODO: def test_pickling_polys_rootisolation():
-#    RealInterval
-#    ComplexInterval
-
 
 def test_pickling_polys_rootoftools():
     f = x**3 + x + 3
@@ -488,16 +438,6 @@ def test_printing():
         check(c)
 
 
-@pytest.mark.xfail
-def test_printing1():
-    check(MathMLPrinter())
-
-
-@pytest.mark.xfail
-def test_printing2():
-    check(PrettyPrinter())
-
-
 def test_series():
     for c in (Limit, Limit(y, x, 1), Order, Order(y)):
         check(c)
diff --git a/diofant/vector/tests/test_printing.py b/diofant/vector/tests/test_printing.py
--- a/diofant/vector/tests/test_printing.py
+++ b/diofant/vector/tests/test_printing.py
@@ -1,5 +1,3 @@
-import pytest
-
 from diofant import Function, Integral, latex
 from diofant import pretty as xpretty
 from diofant.abc import a, b, c
@@ -113,21 +111,6 @@ def test_str_printing():
                          'Integral(f(b), b))*(N.k|N.k)')
 
 
-@pytest.mark.xfail
-def test_pretty_printing_ascii():
-    assert pretty(v[0]) == '0'
-    assert pretty(v[1]) == 'N_i'
-    assert pretty(v[5]) == '(a) N_i + (-b) N_j'
-    assert pretty(v[8]) == pretty_v_8
-    assert pretty(v[2]) == '(-1) N_i'
-    assert pretty(v[11]) == pretty_v_11
-    assert pretty(s) == pretty_s
-    assert pretty(d[0]) == '(0|0)'
-    assert pretty(d[5]) == '(a) (N_i|N_k) + (-b) (N_j|N_k)'
-    assert pretty(d[7]) == pretty_d_7
-    assert pretty(d[10]) == '(cos(a)) (C_i|N_k) + (-sin(a)) (C_j|N_k)'
-
-
 def test_pretty_print_unicode():
     assert upretty(v[0]) == '0'
     assert upretty(v[1]) == 'N_i'