Changeset 1764 for trunk/pylucid_project/tests
- Timestamp:
- 09/12/08 15:05:57 (18 months ago)
- Files:
-
- 1 modified
-
trunk/pylucid_project/tests/markup_creole.py (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pylucid_project/tests/markup_creole.py
r1763 r1764 9 9 django template syntax. 10 10 11 Some Links 12 ~~~~~~~~~~ 13 http://code.google.com/p/creoleparser/source/browse/trunk/creoleparser/tests.py 14 http://hg.moinmo.in/moin/1.7/file/tip/MoinMoin/parser/ 15 http://sheep.art.pl/devel/creole/file/tip 16 http://djikiki.googlecode.com/svn/trunk/djikiki/creole/ 17 18 Differences to Creole 1.0 19 ~~~~~~~~~~~~~~~~~~~~~~~~~ 20 * italics -> <i> and not <em> 21 11 22 Last commit info: 12 23 ~~~~~~~~~~~~~~~~~ … … 47 58 #print ">>>%r<<<" % out_string 48 59 return out_string 49 60 50 61 def _processCreole(self, source_string, should_string): 51 62 """ … … 56 67 out_string = self._parse(source) 57 68 return out_string, should 58 69 59 70 def assertCreole(self, source_string, should_string): 60 71 """ … … 67 78 out_string = out_string.rstrip("\n") 68 79 self.assertEqual(out_string, should) 69 80 70 81 #-------------------------------------------------------------------------- 71 82 72 83 def test_creole_basic1(self): 73 84 out_string = self._parse("a text line.") 74 self.assertEqual(out_string, "<p>a text line. </p>\n\n")75 85 self.assertEqual(out_string, "<p>a text line.</p>\n\n") 86 76 87 def test_creole_basic2(self): 77 88 self.assertCreole(r""" … … 79 90 """, """ 80 91 <p>Force<br /> 81 linebreak </p>82 """) 83 92 linebreak</p> 93 """) 94 84 95 def test_creole_basic3(self): 85 96 self.assertCreole(r""" … … 87 98 or **//both//** or //**both**// 88 99 """, """ 89 <p>Basics: <b>bold</b> or <i>italic</i> <br />90 or <b><i>both</i></b> or <i><b>both</b></i> </p>91 """) 92 100 <p>Basics: <b>bold</b> or <i>italic</i><br /> 101 or <b><i>both</i></b> or <i><b>both</b></i></p> 102 """) 103 93 104 def test_creole_basic4(self): 94 105 self.assertCreole(r""" … … 97 108 A [[internal links|different]] link name. 98 109 """, """ 99 <p>Here is <a href="a internal">a internal</a> link. <br />100 This is <a href="http://domain.tld">external links</a>. <br />101 A <a href="internal links">different</a> link name. </p>102 """) 103 110 <p>Here is <a href="a internal">a internal</a> link.<br /> 111 This is <a href="http://domain.tld">external links</a>.<br /> 112 A <a href="internal links">different</a> link name.</p> 113 """) 114 104 115 def test_django1(self): 105 116 """ 106 117 Test if django template tags are not changed by Creole. 107 118 The Creole image tag use "{{" and "}}", too. 119 We test also the passthrough for all django template blocktags 108 120 """ 109 121 self.assertCreole(r""" 110 122 The current page name: >{{ PAGE.name }}< great? 111 123 A {% lucidTag page_update_list count=10 %} PyLucid plugin 112 124 125 {% sourcecode py %} 126 import sys 127 128 sys.stdout("Hello World!") 129 {% endsourcecode %} 130 113 131 A [[www.domain.tld|link]]. 114 132 a {{/image.jpg|My Image}} image 115 133 116 134 no image: {{ foo|bar }}! 117 135 picture [[www.domain.tld | {{ foo.JPG | Foo }} ]] as a link 118 136 """, """ 119 <p>The current page name: >{{ PAGE.name }}< great? <br /> 120 A {% lucidTag page_update_list count=10 %} PyLucid plugin </p> 121 122 <p>A <a href="www.domain.tld">link</a>. <br /> 123 a <img src="/image.jpg" alt="My Image"> image </p> 124 125 <p>no image: {{ foo|bar }}! <br /> 126 picture <a href="www.domain.tld"><img src="foo.JPG" alt="Foo"></a> as a link </p> 127 """) 128 137 <p>The current page name: >{{ PAGE.name }}< great?<br /> 138 A {% lucidTag page_update_list count=10 %} PyLucid plugin</p> 139 140 {% sourcecode py %} 141 import sys 142 143 sys.stdout("Hello World!") 144 {% endsourcecode %} 145 146 <p>A <a href="www.domain.tld">link</a>.<br /> 147 a <img src="/image.jpg" alt="My Image"> image</p> 148 149 <p>no image: {{ foo|bar }}!<br /> 150 picture <a href="www.domain.tld"><img src="foo.JPG" alt="Foo"></a> as a link</p> 151 """) 152 129 153 def test_nowiki1(self): 130 """131 Test preformatted text132 """133 154 self.assertCreole(r""" 134 155 {{{ … … 140 161 </pre> 141 162 """) 142 163 143 164 def test_nowiki2(self): 144 """145 Test preformatted text146 """147 165 self.assertCreole(r""" 148 166 111 149 167 222 150 168 151 169 {{{ 152 170 333 153 171 }}} 154 172 155 173 444 156 174 """, """ 157 <p>111 <br />158 222 </p>159 175 <p>111<br /> 176 222</p> 177 160 178 <pre> 161 179 333 162 180 </pre> 163 <p>444 </p> 164 """) 165 166 def test_preformatted(self): 167 """ 168 Test preformatted text 169 """ 170 self.assertCreole(r""" 171 This should be also interpreded as preformated: 172 173 {% sourcecode py %} 174 import sys 175 176 sys.stdout("Hello World!") 177 {% endsourcecode %} 178 179 END 180 """, """ 181 <p>This should be also interpreded as preformated: </p> 182 183 {% sourcecode py %} 184 import sys 185 186 sys.stdout("Hello World!") 187 {% endsourcecode %} 188 189 <p>END </p> 190 """) 181 <p>444</p> 182 """) 183 184 def test_bold_italics(self): 185 self.assertCreole(r""" 186 **//bold italics//** 187 //**bold italics**// 188 //This is **also** good.// 189 """, """ 190 <p><b><i>bold italics</i></b><br /> 191 <i><b>bold italics</b></i><br /> 192 <i>This is <b>also</b> good.</i></p> 193 """) 194 195 def test_cross_paragraphs(self): 196 self.assertCreole(""" 197 Bold and italics should //be 198 able// to cross lines. 199 200 But, should //not be... 201 202 ...able// to cross paragraphs. 203 """, """ 204 <p>Bold and italics should <i>be<br /> 205 able</i> to cross lines.</p> 206 207 <p>But, should <i>not be...</i></p> 208 209 <p>...able<i> to cross paragraphs.</i></p> 210 """) 211 212 def test_headlines(self): 213 self.assertCreole(""" 214 = Level 1 (largest) = 215 == Level 2 == 216 === Level 3 === 217 ==== Level 4 ==== 218 ===== Level 5 ===== 219 ====== Level 6 ====== 220 === Also level 3 221 === Also level 3 = 222 === Also level 3 == 223 === **not** //parsed// === 224 No == headline == or? 225 """, """ 226 <h1>Level 1 (largest)</h1> 227 <h2>Level 2</h2> 228 <h3>Level 3</h3> 229 <h4>Level 4</h4> 230 <h5>Level 5</h5> 231 <h6>Level 6</h6> 232 <h3>Also level 3</h3> 233 <h3>Also level 3</h3> 234 <h3>Also level 3</h3> 235 <h3>**not** //parsed//</h3> 236 <p>No == headline == or?</p> 237 """) 238 239 def test_bullet_list(self): 240 self.assertCreole(""" 241 * Item 1 242 ** Item 1.1 243 ** Item 1.2 244 * Item 2 245 ** Item 2.1 246 *** Item 3.1 247 *** Item 3.2 248 """, """ 249 <ul> 250 <li>Item 1 251 <ul> 252 <li>Item 1.1 253 </li> 254 <li>Item 1.2 255 </li> 256 </ul> 257 </li> 258 <li>Item 2 259 <ul> 260 <li>Item 2.1 261 <ul> 262 <li>Item 3.1 263 </li> 264 <li>Item 3.2 265 </li> 266 </ul> 267 </li> 268 </ul> 269 </li> 270 </ul> 271 """) 272 273 def test_number_list(self): 274 self.assertCreole(""" 275 # Item 1 276 ## Item 1.1 277 # Item 2 278 """, """ 279 <ol> 280 <li>Item 1 281 <ol> 282 <li>Item 1.1 283 </li> 284 </ol> 285 </li> 286 <li>Item 2 287 </li> 288 </ol> 289 """) 290 291 def test_horizontal_rule(self): 292 self.assertCreole(""" 293 one 294 ---- 295 two 296 """, """ 297 <p>one</p> 298 <hr /> 299 <p>two</p> 300 """) 301 191 302 192 303