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
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pandas/tests/arrays/test_boolean.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ def test_to_boolean_array_missing_indicators(a, b):
],
)
def test_to_boolean_array_error(values):
# error in converting existing arrays to BooleanArray
with pytest.raises(TypeError):
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 :)

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


Expand Down