diff options
author | Martin Vilcans <martin@librador.com> | 2011-11-22 20:28:08 +0100 |
---|---|---|
committer | Martin Vilcans <martin@librador.com> | 2011-11-22 20:30:53 +0100 |
commit | 179bd424ee8b5a01584cd4cd7d76df8ba8a1f3d4 (patch) | |
tree | 751074aba0c6be2854cdf35af38fe389a6ed99ad /tests/richstring_test.py | |
parent | bce1a38322327256ad2b718269d43371236d0bb7 (diff) | |
download | screenplain-179bd424ee8b5a01584cd4cd7d76df8ba8a1f3d4.tar.gz |
Fix incorrectly parsing when mixing italic and bold. Thx, Stu!
Diffstat (limited to 'tests/richstring_test.py')
-rw-r--r-- | tests/richstring_test.py | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/tests/richstring_test.py b/tests/richstring_test.py index c79981d..2804ec2 100644 --- a/tests/richstring_test.py +++ b/tests/richstring_test.py @@ -126,7 +126,6 @@ class ParseEmphasisTests(unittest2.TestCase): (bold + italic)('really strong') ) - @unittest2.expectedFailure def test_additional_star(self): self.assertEquals( parse_emphasis('*foo* bar* baz'), @@ -152,3 +151,30 @@ class ParseEmphasisTests(unittest2.TestCase): parse_emphasis('_*he_llo*'), (italic + underline)('he') + italic('llo') ) + + def test_complicated(self): + # As reported by Stu + self.assertEquals( + parse_emphasis('You can _underline_ words, make them **bold** or *italic* or even ***bold italic.***'), + (plain('You can ') + underline('underline') + + plain(' words, make them ') + bold('bold') + plain(' or ') + + italic('italic') + plain(' or even ') + (bold + italic)('bold italic.')) + ) + + def test_simplified_complicated(self): + self.assertEquals( + parse_emphasis('*italic* or even ***bold italic.***'), + italic('italic') + plain(' or even ') + (bold + italic)('bold italic.') + ) + + def test_two_italic_should_not_create_one_long_italic_string(self): + self.assertEquals( + parse_emphasis('*first* *second*'), + italic('first') + plain(' ') + italic('second') + ) + + def test_two_bold_should_not_create_one_long_bold_string(self): + self.assertEquals( + parse_emphasis('**first** **second**'), + bold('first') + plain(' ') + bold('second') + ) |