-
Notifications
You must be signed in to change notification settings - Fork 1
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
[DNM] asap-data
Fix empty ligand to_oemol()
error
#998
base: main
Are you sure you want to change the base?
Conversation
def test_empty_ligand(): | ||
lig = Ligand.from_smiles("", compound_name="test_empty") | ||
assert lig.data is None | ||
assert lig.to_oemol() is None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Am I wrong in thinking that the Ligand
instance shouldn't be able to return a None
for this method? This is something that we commonly want to avoid, because this can easily lead to the infamously common "NoneType
is not xxxxxx" error or similar further along the pipeline, which we want to avoid. We want to fail "early".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or in other words, this looks like working around a deeper problem in the underlying classes, namely Ligand
in this case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, what do you think we should be returning instead? or set a validation error for Ligand if it is empty?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, in my opinion having it to fail when it's None
would be better, but that would need to be tested since the behavior is already there and some tools further down the pipeline might already be using this. Now, to be fair, according to the documentation it is not supposed to return None
, and that's the contract we are willing to sign. So, if we are following the documentation (and type annotations) this should be "fine".
asap-data
Fix empty ligand to_oemol()
errorasap-data
Fix empty ligand to_oemol()
error
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
block for DNM
Description
fixes #990
Todos
Notable points that this PR has either accomplished or will accomplish.
Questions
Status
Developers certificate of origin