@@ -76,7 +76,7 @@ def render(i):
7676def test_makes_links_out_of_URLs (url ):
7777 link = '<a style="word-wrap: break-word; word-break: break-word;" href="{}">{}</a>' .format (url , url )
7878 assert notify_email_markdown (url ) == (
79- '<p style="Margin: 0 0 20px 0; font-size: 19px; line-height: 25px; color: #0B0C0C;">' "{}" " </p>"
79+ '<p style="Margin: 0 0 20px 0; font-size: 19px; line-height: 25px; color: #0B0C0C;">{} </p>'
8080 ).format (link )
8181
8282
@@ -102,7 +102,7 @@ def test_makes_links_out_of_URLs(url):
102102)
103103def test_makes_links_out_of_URLs_in_context (input , output ):
104104 assert notify_email_markdown (input ) == (
105- '<p style="Margin: 0 0 20px 0; font-size: 19px; line-height: 25px; color: #0B0C0C;">' "{}" " </p>"
105+ '<p style="Margin: 0 0 20px 0; font-size: 19px; line-height: 25px; color: #0B0C0C;">{} </p>'
106106 ).format (output )
107107
108108
@@ -119,7 +119,7 @@ def test_makes_links_out_of_URLs_in_context(input, output):
119119)
120120def test_doesnt_make_links_out_of_invalid_urls (url ):
121121 assert notify_email_markdown (url ) == (
122- '<p style="Margin: 0 0 20px 0; font-size: 19px; line-height: 25px; color: #0B0C0C;">' "{}" " </p>"
122+ '<p style="Margin: 0 0 20px 0; font-size: 19px; line-height: 25px; color: #0B0C0C;">{} </p>'
123123 ).format (url )
124124
125125
@@ -151,7 +151,7 @@ def test_handles_placeholders_in_urls():
151151)
152152def test_URLs_get_escaped (url , expected_html , expected_html_in_template ):
153153 assert notify_email_markdown (url ) == (
154- '<p style="Margin: 0 0 20px 0; font-size: 19px; line-height: 25px; color: #0B0C0C;">' "{}" " </p>"
154+ '<p style="Margin: 0 0 20px 0; font-size: 19px; line-height: 25px; color: #0B0C0C;">{} </p>'
155155 ).format (expected_html )
156156 assert expected_html_in_template in str (HTMLEmailTemplate ({"content" : url , "subject" : "" }))
157157
@@ -192,11 +192,11 @@ def test_HTML_template_has_URLs_replaced_with_links():
192192 "</p>"
193193 ),
194194 ),
195- (notify_plain_text_email_markdown , ("\n " " \n https://example.com" " \n " " \n Next paragraph" )),
195+ (notify_plain_text_email_markdown , ("\n \n https://example.com\n \n Next paragraph" )),
196196 ],
197197)
198198def test_preserves_whitespace_when_making_links (markdown_function , expected_output ):
199- assert markdown_function ("https://example.com\n " " \n " "Next paragraph" ) == expected_output
199+ assert markdown_function ("https://example.com\n \n Next paragraph" ) == expected_output
200200
201201
202202@pytest .mark .parametrize (
@@ -289,7 +289,7 @@ def test_block_code(markdown_function, expected):
289289 ],
290290 [
291291 notify_plain_text_email_markdown ,
292- ("\n " " \n inset text" ),
292+ ("\n \n inset text" ),
293293 ],
294294 ),
295295)
@@ -319,7 +319,7 @@ def test_block_quote(markdown_function, expected):
319319 ],
320320 [
321321 notify_plain_text_email_markdown ,
322- ("\n " " \n " " \n heading" " \n -----------------------------------------------------------------" ),
322+ ("\n \n \n heading\n -----------------------------------------------------------------" ),
323323 ],
324324 ),
325325)
@@ -338,7 +338,7 @@ def test_level_1_header(markdown_function, heading, expected):
338338 ],
339339 [
340340 notify_plain_text_email_markdown ,
341- ("\n " " \n inset text" " \n -----------------------------------------------------------------" ),
341+ ("\n \n inset text\n -----------------------------------------------------------------" ),
342342 ],
343343 ),
344344)
@@ -349,7 +349,7 @@ def test_level_2_header(markdown_function, expected):
349349@pytest .mark .parametrize (
350350 "markdown_function, expected" ,
351351 (
352- [notify_letter_preview_markdown , (" <p>a</p>" ' <div class="page-break"> </div>' " <p>b</p>" )],
352+ [notify_letter_preview_markdown , (' <p>a</p><div class="page-break"> </div><p>b</p>' )],
353353 [
354354 notify_email_markdown ,
355355 (
@@ -360,7 +360,7 @@ def test_level_2_header(markdown_function, expected):
360360 ],
361361 [
362362 notify_plain_text_email_markdown ,
363- ("\n " " \n a" " \n " " \n =================================================================" " \n " " \n b" ),
363+ ("\n \n a\n \n =================================================================\n \n b" ),
364364 ],
365365 ),
366366)
@@ -374,13 +374,13 @@ def test_hrule(markdown_function, expected):
374374 (
375375 [
376376 notify_letter_preview_markdown ,
377- "1. one\n " "2 . two\n " "3 . three\n " ,
378- ("<ol>\n " " <li>one</li>\n " " <li>two</li>\n " " <li>three</li>\n " " </ol>\n " ),
377+ "1. one\n 2 . two\n 3 . three\n " ,
378+ ("<ol>\n <li>one</li>\n <li>two</li>\n <li>three</li>\n </ol>\n " ),
379379 ],
380- [notify_letter_preview_markdown , "1.one\n " "2 .two\n " "3 .three\n " , "<p>1.one<br>2.two<br>3.three</p>" ],
380+ [notify_letter_preview_markdown , "1.one\n 2 .two\n 3 .three\n " , "<p>1.one<br>2.two<br>3.three</p>" ],
381381 [
382382 notify_email_markdown ,
383- "1. one\n " "2 . two\n " "3 . three\n " ,
383+ "1. one\n 2 . two\n 3 . three\n " ,
384384 (
385385 '<table role="presentation" style="padding: 0 0 20px 0;">'
386386 "<tr>"
@@ -397,7 +397,7 @@ def test_hrule(markdown_function, expected):
397397 ],
398398 [
399399 notify_email_markdown ,
400- "1.one\n " "2 .two\n " "3 .three\n " ,
400+ "1.one\n 2 .two\n 3 .three\n " ,
401401 (
402402 '<p style="Margin: 0 0 20px 0; font-size: 19px; line-height: 25px; color: #0B0C0C;">'
403403 "1.one"
@@ -410,12 +410,12 @@ def test_hrule(markdown_function, expected):
410410 ],
411411 [
412412 notify_plain_text_email_markdown ,
413- "1. one\n " "2 . two\n " "3 . three\n " ,
414- ("\n " " \n 1. one" " \n 2. two" " \n 3. three" ),
413+ "1. one\n 2 . two\n 3 . three\n " ,
414+ ("\n \n 1. one\n 2. two\n 3. three" ),
415415 ],
416416 [
417417 notify_plain_text_email_markdown ,
418- "1.one\n " "2 .two\n " "3 .three\n " ,
418+ "1.one\n 2 .two\n 3 .three\n " ,
419419 "\n \n 1.one\n 2.two\n 3.three" ,
420420 ],
421421 ),
@@ -427,18 +427,18 @@ def test_ordered_list(markdown_function, markdown_input, expected):
427427@pytest .mark .parametrize (
428428 "markdown" ,
429429 (
430- ("* one\n " " * two\n " " * three\n " ), # single space
431- ("* one\n " " * two\n " " * three\n " ), # two spaces
432- ("* one\n " " * two\n " " * three\n " ), # tab
433- ("- one\n " " - two\n " " - three\n " ), # dash as bullet
434- pytest .param (("+ one\n " " + two\n " " + three\n " ), marks = pytest .mark .xfail (raises = AssertionError )), # plus as bullet
435- ("• one\n " " • two\n " " • three\n " ), # bullet as bullet
430+ ("* one\n * two\n * three\n " ), # single space
431+ ("* one\n * two\n * three\n " ), # two spaces
432+ ("* one\n * two\n * three\n " ), # tab
433+ ("- one\n - two\n - three\n " ), # dash as bullet
434+ pytest .param (("+ one\n + two\n + three\n " ), marks = pytest .mark .xfail (raises = AssertionError )), # plus as bullet
435+ ("• one\n • two\n • three\n " ), # bullet as bullet
436436 ),
437437)
438438@pytest .mark .parametrize (
439439 "markdown_function, expected" ,
440440 (
441- [notify_letter_preview_markdown , ("<ul>\n " " <li>one</li>\n " " <li>two</li>\n " " <li>three</li>\n " " </ul>\n " )],
441+ [notify_letter_preview_markdown , ("<ul>\n <li>one</li>\n <li>two</li>\n <li>three</li>\n </ul>\n " )],
442442 [
443443 notify_email_markdown ,
444444 (
@@ -457,7 +457,7 @@ def test_ordered_list(markdown_function, markdown_input, expected):
457457 ],
458458 [
459459 notify_plain_text_email_markdown ,
460- ("\n " " \n • one" " \n • two" " \n • three" ),
460+ ("\n \n • one\n • two\n • three" ),
461461 ],
462462 ),
463463)
@@ -467,7 +467,7 @@ def test_unordered_list(markdown, markdown_function, expected):
467467
468468@pytest .mark .parametrize (
469469 "markdown" ,
470- (("*one\n " " *two\n " " *three\n " ),), # no space
470+ (("*one\n *two\n *three\n " ),), # no space
471471)
472472@pytest .mark .parametrize (
473473 "markdown_function, expected" ,
@@ -506,12 +506,12 @@ def test_unordered_list_with_no_spaces(markdown, markdown_function, expected):
506506 ],
507507 [
508508 notify_plain_text_email_markdown ,
509- ("\n \n + one" " \n \n + two" " \n \n + three" ),
509+ ("\n \n + one\n \n + two\n \n + three" ),
510510 ],
511511 ),
512512)
513513def test_pluses_dont_render_as_lists (markdown_function , expected ):
514- assert markdown_function ("+ one\n " " + two\n " " + three\n " ) == expected
514+ assert markdown_function ("+ one\n + two\n + three\n " ) == expected
515515
516516
517517@pytest .mark .parametrize (
@@ -547,7 +547,7 @@ def test_list_and_bold_or_italic(markdown_function, input, expected):
547547@pytest .mark .parametrize (
548548 "markdown_function, expected" ,
549549 (
550- [notify_letter_preview_markdown , ("<p>" " line one<br>" " line two" " </p>" " <p>" " new paragraph" " </p>" )],
550+ [notify_letter_preview_markdown , ("<p>line one<br>line two</p><p>new paragraph</p>" )],
551551 [
552552 notify_email_markdown ,
553553 (
@@ -558,18 +558,18 @@ def test_list_and_bold_or_italic(markdown_function, input, expected):
558558 ],
559559 [
560560 notify_plain_text_email_markdown ,
561- ("\n " " \n line one" " \n line two" " \n " " \n new paragraph" ),
561+ ("\n \n line one\n line two\n \n new paragraph" ),
562562 ],
563563 ),
564564)
565565def test_paragraphs (markdown_function , expected ):
566- assert markdown_function ("line one\n " "line two\n " " \n " "new paragraph" ) == expected
566+ assert markdown_function ("line one\n line two\n \n new paragraph" ) == expected
567567
568568
569569@pytest .mark .parametrize (
570570 "markdown_function, expected" ,
571571 (
572- [notify_letter_preview_markdown , ("<p>before</p>" " <p>after</p>" )],
572+ [notify_letter_preview_markdown , ("<p>before</p><p>after</p>" )],
573573 [
574574 notify_email_markdown ,
575575 (
@@ -579,7 +579,7 @@ def test_paragraphs(markdown_function, expected):
579579 ],
580580 [
581581 notify_plain_text_email_markdown ,
582- ("\n " " \n before" " \n " " \n after" ),
582+ ("\n \n before\n \n after" ),
583583 ],
584584 ),
585585)
@@ -591,7 +591,7 @@ def test_multiple_newlines_get_truncated(markdown_function, expected):
591591 "markdown_function" , (notify_letter_preview_markdown , notify_email_markdown , notify_plain_text_email_markdown )
592592)
593593def test_table (markdown_function ):
594- assert markdown_function ("col | col\n " " ----|----\n " "val | val\n " ) == ("" )
594+ assert markdown_function ("col | col\n ----|----\n val | val\n " ) == ("" )
595595
596596
597597@pytest .mark .parametrize (
@@ -621,7 +621,7 @@ def test_table(markdown_function):
621621 [
622622 notify_plain_text_email_markdown ,
623623 "http://example.com" ,
624- ("\n " " \n http://example.com" ),
624+ ("\n \n http://example.com" ),
625625 ],
626626 ),
627627)
@@ -673,8 +673,7 @@ def test_double_emphasis(markdown_function, expected, emphasis_style):
673673 [notify_letter_preview_markdown , "<p>something important</p>" ],
674674 [
675675 notify_email_markdown ,
676- '<p style="Margin: 0 0 20px 0; font-size: 19px; line-height: 25px; color: #0B0C0C;">'
677- "something <em>important</em></p>" ,
676+ '<p style="Margin: 0 0 20px 0; font-size: 19px; line-height: 25px; color: #0B0C0C;">something <em>important</em></p>' ,
678677 ],
679678 [
680679 notify_plain_text_email_markdown ,
@@ -727,7 +726,7 @@ def test_image(markdown_function):
727726 ],
728727 [
729728 notify_plain_text_email_markdown ,
730- ("\n " " \n Example: http://example.com" ),
729+ ("\n \n Example: http://example.com" ),
731730 ],
732731 ),
733732)
@@ -752,7 +751,7 @@ def test_link(markdown_function, expected):
752751 ],
753752 [
754753 notify_plain_text_email_markdown ,
755- ("\n " " \n Example (An example URL): http://example.com" ),
754+ ("\n \n Example (An example URL): http://example.com" ),
756755 ],
757756 ),
758757)
@@ -1034,7 +1033,7 @@ def test_tweaking_dvla_list_markup(markup, expected_fixed):
10341033
10351034
10361035def test_make_list_from_linebreaks ():
1037- assert nl2li ("a\n " "b \n " "c \n " ) == ("<ul>" " <li>a</li>" " <li>b</li>" " <li>c</li>" " </ul>" )
1036+ assert nl2li ("a\n b \n c \n " ) == ("<ul><li>a</li><li>b</li><li>c</li></ul>" )
10381037
10391038
10401039@pytest .mark .parametrize (
0 commit comments