Skip to content

added msg to TypeError test_to_boolean_array_error #32103

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

Merged

Conversation

amy-graham-js
Copy link
Contributor

Fixed bare pytest.raises (#30999) for test_to_boolean_array_error in test_boolean.py

Comment on lines 133 to 134
msg = "Error converting existing arrays to BooleanArray"
with pytest.raises(TypeError, match=msg):
Copy link
Member

@MarcoGorelli MarcoGorelli Feb 19, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @amy-graham-js , and welcome :)

The comment

# error in converting existing arrays to BooleanArray

looks like more of a comment on the source code than the expected error, so we should keep it as a comment

To find out which error is actually raised, you could try inserting a breakpoint:

def test_to_boolean_array_error(values):
    # error in converting existing arrays to BooleanArray
    breakpoint()
    with pytest.raises(TypeError):
        pd.array(values, dtype="boolean")

, running the test:

pytest pandas/tests/arrays/test_boolean.py

and then, when the breakpoint is reached, executing the command

pd.array(values, dtype="boolean")

to see what error is raised. Feel free to ask for help if this is unclear

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @MarcoGorelli for your help! Hopefully that should be ok now :)

@simonjayhawkins simonjayhawkins added the Testing pandas testing functions or related to the test suite label Feb 19, 2020
@simonjayhawkins simonjayhawkins added this to the 1.1 milestone Feb 20, 2020
@simonjayhawkins simonjayhawkins merged commit 37a7006 into pandas-dev:master Feb 20, 2020
@simonjayhawkins
Copy link
Member

Thanks @amy-graham-js

@amy-graham-js amy-graham-js deleted the 309999_fix_bare_pytest_raises branch February 25, 2020 10:48
roberthdevries pushed a commit to roberthdevries/pandas that referenced this pull request Mar 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Testing pandas testing functions or related to the test suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants