GromacsWrapper icon indicating copy to clipboard operation
GromacsWrapper copied to clipboard

AttributeDict does not support hasattr()

Open orbeckst opened this issue 4 years ago • 0 comments

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

orbeckst avatar Aug 04 '21 23:08 orbeckst