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
extract code, text as list #26
Conversation
Having I propose we have a This would allow us some flexibility (in assigning stuff to |
@classmethod | ||
def _get_text(cls, html): | ||
soup = BeautifulSoup(html) | ||
[s.extract() for s in soup('code')] |
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.
What does this line do? It's a list comprehension which isn't assigned to anything. I think I see what it does, that it extracts code
tags so that they're not in soup
anymore when you get the text, but can you confirm?
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. it extracts code elements. since we don't need code there, i have not stored it there.
I need to do some more testing with this, to make sure it makes sense in my head and that it does what it is intended. It also needs more unittests to increase the coverage. But looking good :D |
I just did a quick test and I got |
Hey, do you have any idea who K3 is? They've pushed 3 commits, and I don't understand how or who they are. |
super(Answer, self).__init__() | ||
|
||
self._data = data | ||
super(SEObject, self).__init__() |
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.
This should be super(Answer, self).__init__()
. Same for the other classes.
removed boiler plate code using super. |
@@ -0,0 +1,30 @@ | |||
from ..objects import Post, Question, Answer, User, Comment | |||
|
|||
d = {'Body': '<p>bar</p><code>x=1</code>'} |
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.
Should d
be defined in each test? I know that this increases the lines of code, but it also keeps each test independent of each other.
(As discussed in chat) will check this out later tonight, check for PEP8, maybe add some more tests, then see about merging. |
Merged with 998a8bd |
only question, answer object need these methods.
this resolves #21