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

gh-94808: Add test coverage for PyObject_HasAttrString #96627

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

MonadChains
Copy link
Contributor

@MonadChains MonadChains commented Sep 6, 2022

Add test to cover the function HasAttrString of the C API.

@MonadChains MonadChains changed the title gh-94808: Add test coverage for HasAttrString gh-94808: Add test coverage for PyObject_HasAttrString Sep 6, 2022
@mdboom mdboom mentioned this pull request Sep 7, 2022
222 tasks
Copy link
Contributor

@mdboom mdboom left a comment

Thanks so much for the contribution. It looks great other than a few minor comments.

Py_RETURN_TRUE;
else
Py_RETURN_FALSE;
}
Copy link
Contributor

@mdboom mdboom Sep 7, 2022

Choose a reason for hiding this comment

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

Sorry for the nit, but I don't think there's automatic tooling to check this. Can you reformat this to comply with PEP7.


a = A()
self.assertEqual(_testcapi.hasattr_string(a, "attr"), True)
self.assertEqual(_testcapi.hasattr_string(a, "noattr"), False)
Copy link
Contributor

@mdboom mdboom Sep 7, 2022

Choose a reason for hiding this comment

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

It might also be worth asserting that there's no exception set in this case:

self.assertEqual(sys.exc_info(), (None, None, None))

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

Successfully merging this pull request may close these issues.

None yet

4 participants