Skip to content
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
Closed

Approx repr ugly with complex numbers #2082

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

Comments

@adler-j
Copy link

@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 Approx repr ugly with complex numbers: Approx repr ugly with complex numbers Nov 24, 2016
@nicoddemus
Copy link
Member

@nicoddemus 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants