Skip to content

assertion rewriting fails with 'in' and 'and' operators #79

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
pytestbot opened this issue Oct 14, 2011 · 3 comments
Closed

assertion rewriting fails with 'in' and 'and' operators #79

pytestbot opened this issue Oct 14, 2011 · 3 comments
Labels
type: bug problem that needs to be addressed

Comments

@pytestbot
Copy link
Contributor

Originally reported by: Zbigniew Jędrzejewski-Szmek (BitBucket: zbyszek, GitHub: zbyszek)


Minimal testcase:

  def test_sets():
      assert 1 in {} and 2 in {}

platform linux -- Python 3.3.0 -- pytest-2.1.3dev1

========================================================== ERRORS ==========================================================
_________________________________________ ERROR collecting mdp/test/test_graph.py __________________________________________
../../../../usr/lib/python3.3/site-packages/py-1.4.5-py3.3.egg/py/_path/local.py:529: in pyimport
>           mod = __import__(modname, None, None, ['__doc__'])
../../../../usr/lib/python3.3/site-packages/pytest-2.1.3dev1-py3.3.egg/_pytest/assertion/rewrite.py:136: in find_module
>           co = _rewrite_test(state, fn_pypath)
../../../../usr/lib/python3.3/site-packages/pytest-2.1.3dev1-py3.3.egg/_pytest/assertion/rewrite.py:207: in _rewrite_test
>           co = compile(tree, fn.strpath, "exec")
E           TypeError: non-numeric type in Num
=========================================================== NOTE ===========================================================

@pytestbot
Copy link
Contributor Author

Original comment by Zbigniew Jędrzejewski-Szmek (BitBucket: zbyszek, GitHub: zbyszek):


I forgot to mention, that with --assert=plain, it works fine (and the test fails).

@pytestbot
Copy link
Contributor Author

Original comment by Benjamin Peterson (BitBucket: gutworth, GitHub: gutworth):


put the explanation generating code in the conditional fail body (fixes #79)

@pytestbot
Copy link
Contributor Author

Original comment by Zbigniew Jędrzejewski-Szmek (BitBucket: zbyszek, GitHub: zbyszek):


Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug problem that needs to be addressed
Projects
None yet
Development

No branches or pull requests

1 participant