Becksteinlab / GromacsWrapper

GromacsWrapper wraps system calls to GROMACS tools into thin Python classes (GROMACS 4.6.5 - 2024 supported).

Home Page:https://gromacswrapper.readthedocs.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AttributeDict does not support hasattr()

orbeckst opened this issue · 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

Here is my little proposal of a fix #269