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

AttributeDict does not support hasattr() #210

Closed
orbeckst opened this issue Aug 4, 2021 · 1 comment · Fixed by #269
Closed

AttributeDict does not support hasattr() #210

orbeckst opened this issue Aug 4, 2021 · 1 comment · Fixed by #269
Labels

Comments

@orbeckst
Copy link
Member

orbeckst commented Aug 4, 2021

AttributeDict does not support hasattr() but it should:

import gromacs

ad = gromacs.utilities.AttributeDict(a=1, b=2)

assert hasattr(ad, "a")
assert not hasattr(ad, "x")    # raises AttributeError from KeyError

Using in is a workaround:

assert "a" in ad
assert "x" not in ad
@jandom
Copy link
Collaborator

jandom commented Nov 10, 2023

Here is my little proposal of a fix #269

@orbeckst orbeckst linked a pull request Nov 11, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants