-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added nolinks flag to skip links during rendering
- Loading branch information
Showing
3 changed files
with
95 additions
and
0 deletions.
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
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 |
---|---|---|
|
@@ -422,6 +422,64 @@ | |
'<p><table scope="foo"></p>\n', | ||
} | ||
|
||
|
||
no_links_cases = { | ||
'http://www.reddit.com': | ||
'<p>http://www.reddit.com</p>\n', | ||
|
||
'http://www.reddit.com/a\x00b': | ||
'<p>http://www.reddit.com/ab</p>\n', | ||
|
||
'ampersands http://www.google.com?test&blah': | ||
'<p>ampersands http://www.google.com?test&blah</p>\n', | ||
|
||
'www.http://example.com/': | ||
'<p>www.http://example.com/</p>\n', | ||
|
||
'[email protected]': | ||
'<p>[email protected]</p>\n', | ||
|
||
'/u/test/m/test test': | ||
'<p>/u/test/m/test test</p>\n', | ||
|
||
'/u/test': | ||
'<p>/u/test</p>\n', | ||
|
||
'/r/not.cool': | ||
'<p>/r/not.cool</p>\n', | ||
|
||
'u/test': | ||
'<p>u/test</p>\n', | ||
|
||
'/r/whatever: fork': | ||
'<p>/r/whatever: fork</p>\n', | ||
|
||
'/r/t:timereddit': | ||
'<p>/r/t:timereddit</p>\n', | ||
|
||
'/r/reddit.com': | ||
'<p>/r/reddit.com</p>\n', | ||
|
||
'r/not.cool': | ||
'<p>r/not.cool</p>\n', | ||
|
||
'/r/very+clever+multireddit+reddit.com+t:fork+yay': | ||
'<p>/r/very+clever+multireddit+reddit.com+t:fork+yay</p>\n', | ||
|
||
'/r/t:heatdeathoftheuniverse': | ||
'<p>/r/t:heatdeathoftheuniverse</p>\n', | ||
|
||
'/r/all-minus-something': | ||
'<p>/r/all-minus-something</p>\n', | ||
|
||
r'escaped \/r/test': | ||
'<p>escaped /r/test</p>\n', | ||
|
||
'Words words /r/test words': | ||
'<p>Words words /r/test words</p>\n', | ||
} | ||
|
||
|
||
class SnudownTestCase(unittest.TestCase): | ||
def __init__(self, renderer=snudown.RENDERER_USERTEXT): | ||
self.renderer = renderer | ||
|
@@ -458,4 +516,10 @@ def test_snudown(): | |
case.expected_output = expected_output | ||
suite.addTest(case) | ||
|
||
for input, expected_output in no_links_cases.iteritems(): | ||
case = SnudownTestCase(renderer=snudown.RENDERER_USERTEXT_WITHOUTLINKS) | ||
case.input = input | ||
case.expected_output = expected_output | ||
suite.addTest(case) | ||
|
||
return suite |