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
Labels
good first issue easy issue that is friendly to new contributor status: help wanted developers would like help from experts on this topic type: enhancement new feature or API change, should be merged into features branch

Comments

@adler-j
Copy link

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 nicoddemus added good first issue easy issue that is friendly to new contributor type: enhancement new feature or API change, should be merged into features branch status: help wanted developers would like help from experts on this topic labels Nov 24, 2016
@nicoddemus
Copy link
Member

Agreed, thanks for reporting this!

nicoddemus added a commit to nicoddemus/pytest that referenced this issue Nov 24, 2016
DuncanBetts pushed 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
Labels
good first issue easy issue that is friendly to new contributor status: help wanted developers would like help from experts on this topic type: enhancement new feature or API change, should be merged into features branch
Projects
None yet
Development

No branches or pull requests

2 participants