Conversation
| # test invalid argument | ||
| resapi = self.reader.getRelatedModels(code = models.ActionBy) | ||
| assert resapi is None | ||
| resapi = self.reader.getRelatedModels(code = 234123) |
There was a problem hiding this comment.
When I test this on a local postgresql, it gives me a None rather than an empty list. For now, this assertion works, but just an fyi in the future, I have placed a comment in the code.
There was a problem hiding this comment.
You can use assert not a that will be valid for both [] and None. (Or anything that evaluates to "empty.")
Rant: python has too many nulls!
There was a problem hiding this comment.
You can use
assert not athat will be valid for both[]andNone.
What do you mean by this? What's an example? Sorry, I'm a noob when it comes to assertion multiple things.
There was a problem hiding this comment.
If either an empty list or None is expected, maybe due to different versions of the dependencies; unclear on the reason, you can use assert not resapi there. (sorry for the dummy a I used above).
It means that you are expecting a NULL value, may it be an empty list or None or anything that will evaluate to False in Python. Makes sense?
There was a problem hiding this comment.
Thanks for the explanation @ocefpaf. I'll keep picking at your brain 😄
|
LGTM. Merging b/c my comment above is syntax sugar and not a requirement. Thanks @lsetiawan! |
Overview
This PR is a follow up to #90 and #91. It fixes some of the failing test functions that seem to use an older version of ODM2PythonAPI.
Notes
I've change some of the function to use the latest ODM2Python API, and the tests now appear to pass in travis-ci. Some fixes that would be beneficial to further develop the tests includes