-
Notifications
You must be signed in to change notification settings - Fork 1
Parser tests #19
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
Parser tests #19
Conversation
| fixture = open(file_path, 'r').read() | ||
| return fixture | ||
|
|
||
| def assert_blog_posts_equal(self, actual_post, expected_post): |
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.
How about implementing __eq__ on post instead. Seems to be pretty straight-foward:
def __eq__(self, other):
return (isinstance(other, self.__class__)
and self.__dict__ == other.__dict__)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.
How about implementing eq on post instead.
TIL about __dict__ :)
One disadvantage is that it becomes impossible to find out whats wrong by looking at the test output:
AssertionError: 'Skvallernytt.se' != u'FEL'
# becomes:
AssertionError: <twingly_search.post.Post object at 0x10a8b76d0> != <twingly_search.post.Post object at 0x10a8b75d0>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.
That's true.
|
Looks shippable to me. |
|
|
To quote @dentarg in twingly/twingly-search-api-ruby#49 😄