test_parser.py
27 lines
| 916 B
| text/x-python
|
PythonLexer
neko259
|
r886 | from django.test import TestCase | ||
from boards.models import Post | ||||
class ParserTest(TestCase): | ||||
def test_preparse_quote(self): | ||||
neko259
|
r887 | raw_text = '>quote\nQuote in >line\nLine\n>Quote' | ||
neko259
|
r886 | preparsed_text = Post.objects._preparse_text(raw_text) | ||
neko259
|
r887 | self.assertEqual( | ||
'[quote]quote[/quote]\nQuote in >line\nLine\n[quote]Quote[/quote]', | ||||
neko259
|
r888 | preparsed_text, 'Quote not preparsed.') | ||
def test_preparse_comment(self): | ||||
raw_text = '//comment' | ||||
preparsed_text = Post.objects._preparse_text(raw_text) | ||||
self.assertEqual('[comment]comment[/comment]', preparsed_text, | ||||
neko259
|
r926 | 'Comment not preparsed.') | ||
def test_preparse_reflink(self): | ||||
raw_text = '>>12\nText' | ||||
preparsed_text = Post.objects._preparse_text(raw_text) | ||||
self.assertEqual('[post]12[/post]\nText', | ||||
preparsed_text, 'Reflink not preparsed.') | ||||