comparison test/test_templating.py @ 7923:29a666d8a70d

issue2551285 - Remove StructuredText support Asked on the users mailing list if anybody was using it. Got no responses. I have never seen CI installing structuredtext packages so it's untested as well.
author John Rouillard <rouilj@ieee.org>
date Tue, 30 Apr 2024 22:27:57 -0400
parents 9bbc1d951677
children a9b136565838
comparison
equal deleted inserted replaced
7922:ded9f1c3f112 7923:29a666d8a70d
20 if ReStructuredText: 20 if ReStructuredText:
21 skip_rst = lambda func, *args, **kwargs: func 21 skip_rst = lambda func, *args, **kwargs: func
22 else: 22 else:
23 skip_rst = mark_class(pytest.mark.skip( 23 skip_rst = mark_class(pytest.mark.skip(
24 reason='ReStructuredText not available')) 24 reason='ReStructuredText not available'))
25
26 if StructuredText:
27 skip_stext = lambda func, *args, **kwargs: func
28 else:
29 skip_stext = mark_class(pytest.mark.skip(
30 reason='StructuredText not available'))
31 25
32 import roundup.cgi.templating 26 import roundup.cgi.templating
33 if roundup.cgi.templating._import_mistune(): 27 if roundup.cgi.templating._import_mistune():
34 skip_mistune = lambda func, *args, **kwargs: func 28 skip_mistune = lambda func, *args, **kwargs: func
35 else: 29 else:
567 self.assertEqual(q.rst(), u2s(q_result)) 561 self.assertEqual(q.rst(), u2s(q_result))
568 self.assertEqual(r.rst(), u2s(r_result)) 562 self.assertEqual(r.rst(), u2s(r_result))
569 self.assertEqual(s.rst(), u2s(s_result)) 563 self.assertEqual(s.rst(), u2s(s_result))
570 self.assertEqual(t.rst(), u2s(t_result)) 564 self.assertEqual(t.rst(), u2s(t_result))
571 self.assertEqual(u.rst(), u2s(u_result)) 565 self.assertEqual(u.rst(), u2s(u_result))
572
573 @skip_stext
574 def test_string_stext(self):
575 p = StringHTMLProperty(self.client, 'test', '1', None, 'test', u2s(u'A string with cmeerw@example.com *embedded* \u00df'))
576 self.assertEqual(p.stext(), u2s(u'<p>A string with <a href="mailto:cmeerw@example.com">cmeerw@example.com</a> <em>embedded</em> \u00df</p>\n'))
577 566
578 def test_string_field(self): 567 def test_string_field(self):
579 p = StringHTMLProperty(self.client, 'test', '1', None, 'test', 'A string <b> with rouilj@example.com embedded &lt; html</b>') 568 p = StringHTMLProperty(self.client, 'test', '1', None, 'test', 'A string <b> with rouilj@example.com embedded &lt; html</b>')
580 self.assertEqual(p.field(), '<input name="test1@test" size="30" type="text" value="A string &lt;b&gt; with rouilj@example.com embedded &amp;lt; html&lt;/b&gt;">') 569 self.assertEqual(p.field(), '<input name="test1@test" size="30" type="text" value="A string &lt;b&gt; with rouilj@example.com embedded &amp;lt; html&lt;/b&gt;">')
581 570
1101 1090
1102 def test_string_rst(self): 1091 def test_string_rst(self):
1103 p = StringHTMLProperty(self.client, 'test', '1', None, 'test', u2s(u'A string with cmeerw@example.com *embedded* \u00df')) 1092 p = StringHTMLProperty(self.client, 'test', '1', None, 'test', u2s(u'A string with cmeerw@example.com *embedded* \u00df'))
1104 self.assertEqual(p.rst(), u2s(u'A string with <a href="mailto:cmeerw@example.com">cmeerw@example.com</a> *embedded* \u00df')) 1093 self.assertEqual(p.rst(), u2s(u'A string with <a href="mailto:cmeerw@example.com">cmeerw@example.com</a> *embedded* \u00df'))
1105 1094
1106 class NoStextTestCase(TemplatingTestCase) :
1107 def setUp(self):
1108 TemplatingTestCase.setUp(self)
1109
1110 from roundup.cgi import templating
1111 self.__StructuredText = templating.StructuredText
1112 templating.StructuredText = None
1113
1114 def tearDown(self):
1115 from roundup.cgi import templating
1116 templating.StructuredText = self.__StructuredText
1117
1118 def test_string_stext(self):
1119 p = StringHTMLProperty(self.client, 'test', '1', None, 'test', u2s(u'A string with cmeerw@example.com *embedded* \u00df'))
1120 self.assertEqual(p.stext(), u2s(u'A string with <a href="mailto:cmeerw@example.com">cmeerw@example.com</a> *embedded* \u00df'))
1121
1122
1123 class ZUtilsTestcase(TemplatingTestCase): 1095 class ZUtilsTestcase(TemplatingTestCase):
1124 1096
1125 def test_Iterator(self): 1097 def test_Iterator(self):
1126 """Test all the iterator functions and properties. 1098 """Test all the iterator functions and properties.
1127 """ 1099 """

Roundup Issue Tracker: http://roundup-tracker.org/