Skip to content

-vvv doesn't remove the ... from the assertion error #2256

@asmeurer

Description

@asmeurer

Consider for instance, this test. If I change it so that it fails, I get the following output

transmutagenmaster*%=$PYTHONPATH=~/Documents/python/sympy/sympy py.test -vvv transmutagen/tests/test_partialfrac.py
==================================================================== test session starts =====================================================================
platform darwin -- Python 3.5.2, pytest-3.0.5, py-1.4.31, pluggy-0.4.0 -- /Users/aaronmeurer/anaconda/bin/python
cachedir: .cache
rootdir: /Users/aaronmeurer/Documents/transmutagen, inifile:
plugins: xonsh-0.5.4
collected 5 items

transmutagen/tests/test_partialfrac.py::test_re_form PASSED
transmutagen/tests/test_partialfrac.py::test_allroots PASSED
transmutagen/tests/test_partialfrac.py::test_exprs PASSED
transmutagen/tests/test_partialfrac.py::test_forms PASSED
transmutagen/tests/test_partialfrac.py::test_multiply_vector FAILED

========================================================================== FAILURES ==========================================================================
____________________________________________________________________ test_multiply_vector ____________________________________________________________________

    def test_multiply_vector():
        rat_func_vec = multiply_vector(rat_func4, n0)

        assert rat_func_vec == sympify("""(0.0000016765299308108737248115802898*t**4*n0 -
        0.000449815029070811764481317961325*t**3*n0 +
        0.0184005623076780392150344724797*t**2*n0 -
        0.240254024325459538837623100106*t*n0 +
        0.999913477593047111476517762205*n0)/(0.0193768295387776807297603967312*t**4
        + 0.045750548404322635676959079107*t**3 +
        0.291753976337465123448099119431*t**2 + 0.756683068883297082135320717398*t
        + 1.0)""", locals=globals())

        rat_func_horner_vec = multiply_vector(rat_func4, n0, horner=True)

        assert rat_func_horner_vec == sympify("""(t*(t*(t*(0.0000016765299308108737248115802898*t*n0 -
        0.000449815029070811764481317961325*n0) +
        0.0184005623076780392150344724797*n0) -
        0.240254024325459538837623100106*n0) +
        0.999913477593047111476517762205*n0)/(t*(t*(t*(0.0193768295387776807297603967312*t
        + 0.045750548404322635676959079107) + 0.291753976337465123448099119431) +
        0.756683068883297082135320717398) + 1.0)""", locals=globals())

        part_frac_vec = multiply_vector(part_frac4, n0)

        assert part_frac_vec == sympify("""Add(Mul(Float('0.0000865224069528885234822377947049701', prec=30), Symbol('n0', commutative=False)), Mul(Pow(Add(Pow(Add(Symbol('t', real=True), Float('1.54839322329712217439052993875215', prec=30)), Integer(2)), Float('1.42044193610767940377598420545949', prec=30)), Integer(-1)), Add(Mul(Float('0.123373559135665848335708447159696', prec=30), Symbol('t', real=True), Symbol('n0', commutative=False)), Mul(Float('4.73197388969770152224375609265371', prec=30), Symbol('n0', commutative=False)))), Mul(Pow(Add(Pow(Add(Symbol('t', real=True), Float('-0.3678453861815398380437964998596', prec=30)), Integer(2)), Float('13.3818514358464994390440914505336', prec=30)), Integer(-1)), Add(Mul(Integer(-1), Float('0.146791914327884414916885688023602', prec=30), Symbol('t', real=True), Symbol('n0', commutative=False)), Mul(Integer(-1), Float('3.2383118731979676875149681474714', prec=30), Symbol('n0', commutative=False)))))""", locals=globals())

        part_frac_complex_vec = multiply_vector(part_frac_complex4, n0)

        # TODO: Form where the complex numbers aren't distributed
>       assert part_frac_complex_vec == sympify("""Add(Mul(Float('0.000086522469528885234822377947049701', prec=30), Symbol('n0', commutative=False)), Mul(Integer(2), customre(Add(Mul(Pow(Add(Symbol('t', real=True), Float('1.54839322329712217439052993875215', prec=30), Mul(Integer(-1), Float('1.19182294662742561401495340245672', prec=30), I)), Integer(-1)), Add(Mul(Float('0.061686779567832924167854223579848', prec=30), Symbol('n0', commutative=False)), Mul(Integer(-1), Float('1.90504097930308129535280142244488', prec=30), I, Symbol('n0', commutative=False)))), Mul(Pow(Add(Symbol('t', real=True), Float('-0.3678453861815398380437964998596', prec=30), Mul(Integer(-1), Float('3.65812129867866730352792994532021', prec=30), I)), Integer(-1)), Add(Mul(Integer(-1), Float('0.073395957163942207458442844011801', prec=30), Symbol('n0', commutative=False)), Mul(Float('0.449999922474062719432845030483482', prec=30), I, Symbol('n0', commutative=False))))))))""",
        locals=globals())
E       assert 0.000086522406952888523482237794705*n0 + 2*customre((0.0616867795678329241678542235798*n0 - 1.905040979303081295352801...*n0 + 0.449999922474062719432845030483*I*n0)/(t - 0.36784538618153983804379649986 - 3.65812129867866730352792994532*I)) == 0.0000865224695288852348223779470497*n0 + 2*customre((0.0616867795678329241678542235798*n0 - 1.90504097930308129535280...*n0 + 0.449999922474062719432845030483*I*n0)/(t - 0.36784538618153983804379649986 - 3.65812129867866730352792994532*I))
E        +  where 0.0000865224695288852348223779470497*n0 + 2*customre((0.0616867795678329241678542235798*n0 - 1.90504097930308129535280...*n0 + 0.449999922474062719432845030483*I*n0)/(t - 0.36784538618153983804379649986 - 3.65812129867866730352792994532*I)) = sympify("Add(Mul(Float('0.000086522469528885234822377947049701', prec=30), Symbol('n0', commutative=False)), Mul(Integer(2), c...mutative=False)), Mul(Float('0.449999922474062719432845030483482', prec=30), I, Symbol('n0', commutative=False))))))))", locals={'@py_builtins': <module 'builtins' (built-in)>, '@pytest_ar': <module '_pytest.assertion.rewrite' from '/Users/aaronm...'/Users/aaronmeurer/Documents/transmutagen/transmutagen/tests/__pycache__/test_partialfrac.cpython-35-PYTEST.pyc', ...})
E        +    where {'@py_builtins': <module 'builtins' (built-in)>, '@pytest_ar': <module '_pytest.assertion.rewrite' from '/Users/aaronm...'/Users/aaronmeurer/Documents/transmutagen/transmutagen/tests/__pycache__/test_partialfrac.cpython-35-PYTEST.pyc', ...} = globals()

transmutagen/tests/test_partialfrac.py:137: AssertionError
============================================================= 1 failed, 4 passed in 7.25 seconds =============================================================

Note that even though I used -vvv, it still puts the ... in the output, making it very difficult to see why the test failed. In this case, I just changed a number, which happens to be in the output, so you can see it, but in general, the difference requires me to see the whole thing.

Note, if you want to run this test yourself, you'll need to run against this pull request (you'll also need numpy and scipy).

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: reportingrelated to terminal output and user-facing messages and errorstype: bugproblem that needs to be addressed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions