forked from aaronsw/html2text
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't bring value of previous calls of handle() to the new one.
Fix aaronsw#13
- Loading branch information
Matěj Cepl
committed
Jul 2, 2014
1 parent
a8a0bb3
commit f91a6aa
Showing
2 changed files
with
42 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import sys | ||
if sys.version_info[:2] < (2, 7): | ||
import unittest2 as unittest | ||
else: | ||
import unittest | ||
import logging | ||
logging.basicConfig(format='%(levelname)s:%(funcName)s:%(message)s', | ||
level=logging.DEBUG) | ||
|
||
import html2text | ||
|
||
|
||
class TestMemleak(unittest.TestCase): | ||
""" | ||
See https://github.com/Alir3z4/html2text/issues/13 for more | ||
information on this. | ||
""" | ||
|
||
def setUp(self): | ||
self.instr = 'miow ' | ||
|
||
def test_same_string(self): | ||
h2t = html2text.HTML2Text() | ||
result = h2t.handle(self.instr) | ||
# Now, we shouldn't get leak of the previous run to the new one | ||
self.assertEqual(h2t.handle(self.instr), result) | ||
|
||
def test_empty_string(self): | ||
h2t = html2text.HTML2Text() | ||
h2t.handle(self.instr) | ||
# And even less when the input is empty | ||
self.assertEqual(h2t.handle(''), u'\n\n') |