Is your feature request related to a problem? Please describe.
The ResultRecord.get_molecule() function currently checks for a client before checking to see if the molecule is already cached. This means that a client is required even when the local cache is available, and hence a REST call does not need to be made.
I ran into this issue when trying to store a record + it's associated molecule locally, and then loading and combining the two for use in some unit tests. In this case the cache is populated, but the client is not set.
Describe the solution you'd like
It would be good to move the client check inside of the if statement which is triggered when the molecule is not in the cache.
Describe alternatives you've considered
My current workaround is to just monkey patch the client check inside the unit tests to return true regardless if the client is present. There maybe be a more canonical way to handle this however that I'm not aware of, so please let me know if this is the case.
Is your feature request related to a problem? Please describe.
The
ResultRecord.get_molecule()
function currently checks for a client before checking to see if the molecule is already cached. This means that a client is required even when the local cache is available, and hence a REST call does not need to be made.I ran into this issue when trying to store a record + it's associated molecule locally, and then loading and combining the two for use in some unit tests. In this case the cache is populated, but the client is not set.
Describe the solution you'd like
It would be good to move the client check inside of the if statement which is triggered when the molecule is not in the cache.
Describe alternatives you've considered
My current workaround is to just monkey patch the client check inside the unit tests to return true regardless if the client is present. There maybe be a more canonical way to handle this however that I'm not aware of, so please let me know if this is the case.
Additional context