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

Approx repr ugly with complex numbers #2082

Closed
adler-j opened this Issue Nov 24, 2016 · 1 comment

Comments

Projects
None yet
2 participants
@adler-j

adler-j commented Nov 24, 2016

MWE:

def test_complex():
    assert pytest.approx(1j) == 2j

Result:


=================================== FAILURES ===================================
_________________________________ test_complex _________________________________

>   ???
E   assert <[TypeError("can't convert complex to float") raised in repr()] SafeRepr object at 0x7f40613577a0> == 2j
E    +  where <[TypeError("can't convert complex to float") raised in repr()] SafeRepr object at 0x7f40613577a0> = <class '_pytest.python.approx'>(1j)
E    +    where <class '_pytest.python.approx'> = pytest.approx

This should clearly be fixed.

Version:

>>> pytest.__version__
'3.0.3'

@adler-j adler-j changed the title from Approx repr ugly with complex numbers: to Approx repr ugly with complex numbers Nov 24, 2016

@nicoddemus

This comment has been minimized.

Member

nicoddemus commented Nov 24, 2016

Agreed, thanks for reporting this!

nicoddemus added a commit to nicoddemus/pytest that referenced this issue Nov 24, 2016

DuncanBetts added a commit to DuncanBetts/pytest that referenced this issue Nov 26, 2016

This was referenced Mar 5, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment