summaryrefslogtreecommitdiff
path: root/user/py3-docutils/py311-test.patch
blob: 4975b65bab4b80f36b46b84cb408d8a7b8a22785 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
From de1e14dd9374cf9932be4ee43970083ad332cd98 Mon Sep 17 00:00:00 2001
From: milde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>
Date: Sat, 27 Nov 2021 16:28:38 +0000
Subject: [PATCH] Special-casing for Python 3.11: Null char valid in CSV.

First part of a fix for bug #436.

git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@8909 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
---
 test/DocutilsTestSupport.py                        |  1 +
 .../test_rst/test_directives/test_tables.py        | 88 ++++++++++++++++++----
 2 files changed, 76 insertions(+), 13 deletions(-)

diff --git a/test/DocutilsTestSupport.py b/test/DocutilsTestSupport.py
index 592d3f9df..e1f33aa7a 100644
--- a/test/DocutilsTestSupport.py
+++ b/test/DocutilsTestSupport.py
@@ -818,6 +818,7 @@ def exception_data(func, *args, **kwds):
     except Exception as detail:
         return (detail, detail.args,
                 '%s: %s' % (detail.__class__.__name__, detail))
+    return None, [], "No exception"
 
 
 def _format_str(*args):
diff --git a/test/test_parsers/test_rst/test_directives/test_tables.py b/test/test_parsers/test_rst/test_directives/test_tables.py
index 07be0122f..b030e7552 100755
--- a/test/test_parsers/test_rst/test_directives/test_tables.py
+++ b/test/test_parsers/test_rst/test_directives/test_tables.py
@@ -65,6 +65,79 @@ def null_bytes():
     next(reader)
 
 null_bytes_exception = DocutilsTestSupport.exception_data(null_bytes)[0]
+# Null bytes are valid in Python 3.11+:
+if null_bytes_exception is None:
+    bad_encoding_result = """\
+<document source="test data">
+<document source="test data">
+    <table>
+        <title>
+            good encoding
+        <tgroup cols="3">
+            <colspec colwidth="33">
+            <colspec colwidth="33">
+            <colspec colwidth="33">
+            <thead>
+                <row>
+                    <entry>
+                        <paragraph>
+                            Treat
+                    <entry>
+                        <paragraph>
+                            Quantity
+                    <entry>
+                        <paragraph>
+                            Description
+            <tbody>
+                <row>
+                    <entry>
+                        <paragraph>
+                            Albatr\u00b0\u00df
+                    <entry>
+                        <paragraph>
+                            2.99
+                    <entry>
+                        <paragraph>
+                            \u00a1On a \u03c3\u03c4\u03b9\u03ba!
+                <row>
+                    <entry>
+                        <paragraph>
+                            Crunchy Frog
+                    <entry>
+                        <paragraph>
+                            1.49
+                    <entry>
+                        <paragraph>
+                            If we took the b\u00f6nes out, it wouldn\u2019t be
+                            crunchy, now would it?
+                <row>
+                    <entry>
+                        <paragraph>
+                            Gannet Ripple
+                    <entry>
+                        <paragraph>
+                            1.99
+                    <entry>
+                        <paragraph>
+                            \u00bfOn a \u03c3\u03c4\u03b9\u03ba?
+    <paragraph>
+        (7- and 8-bit text encoded as UTF-16 has lots of null/zero bytes.)
+""" % (null_bytes_exception, utf_16_csv)
+else:
+    bad_encoding_result = """\
+<document source="test data">
+    <system_message level="3" line="1" source="test data" type="ERROR">
+        <paragraph>
+            Error with CSV data in "csv-table" directive:
+            %s
+        <literal_block xml:space="preserve">
+            .. csv-table:: bad encoding
+               :file: %s
+               :encoding: latin-1
+    <paragraph>
+        (7- and 8-bit text encoded as UTF-16 has lots of null/zero bytes.)
+""" % (null_bytes_exception, utf_16_csv)
+
 
 totest = {}
 
@@ -1031,19 +1104,8 @@ u"""\
 
 (7- and 8-bit text encoded as UTF-16 has lots of null/zero bytes.)
 """ % utf_16_csv,
-"""\
-<document source="test data">
-    <system_message level="3" line="1" source="test data" type="ERROR">
-        <paragraph>
-            Error with CSV data in "csv-table" directive:
-            %s
-        <literal_block xml:space="preserve">
-            .. csv-table:: bad encoding
-               :file: %s
-               :encoding: latin-1
-    <paragraph>
-        (7- and 8-bit text encoded as UTF-16 has lots of null/zero bytes.)
-""" % (null_bytes_exception, utf_16_csv)],
+bad_encoding_result
+],
 ["""\
 .. csv-table:: good encoding
    :file: %s
-- 
2.11.4.GIT

From 83b6811e753947c9d8576d410c635b36d515657c Mon Sep 17 00:00:00 2001
From: grubert <grubert@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>
Date: Sat, 27 Nov 2021 21:16:41 +0000
Subject: [PATCH] Change
 test/test_parsers/test_rst/test_directives/test_tables.py for python 3.11.0a2
 csv modules supports null character.

git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@8910 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
---
 .../test_rst/test_directives/test_tables.py        | 51 ++++++++++++++--------
 1 file changed, 31 insertions(+), 20 deletions(-)

diff --git a/test/test_parsers/test_rst/test_directives/test_tables.py b/test/test_parsers/test_rst/test_directives/test_tables.py
index b030e7552..73724ed7e 100755
--- a/test/test_parsers/test_rst/test_directives/test_tables.py
+++ b/test/test_parsers/test_rst/test_directives/test_tables.py
@@ -69,60 +69,73 @@ null_bytes_exception = DocutilsTestSupport.exception_data(null_bytes)[0]
 if null_bytes_exception is None:
     bad_encoding_result = """\
 <document source="test data">
-<document source="test data">
     <table>
         <title>
-            good encoding
-        <tgroup cols="3">
-            <colspec colwidth="33">
-            <colspec colwidth="33">
-            <colspec colwidth="33">
-            <thead>
+            bad encoding
+        <tgroup cols="4">
+            <colspec colwidth="25">
+            <colspec colwidth="25">
+            <colspec colwidth="25">
+            <colspec colwidth="25">
+            <tbody>
                 <row>
                     <entry>
                         <paragraph>
-                            Treat
+                            \xfe\xff"Treat"
                     <entry>
                         <paragraph>
-                            Quantity
+                            "Quantity"
                     <entry>
                         <paragraph>
-                            Description
-            <tbody>
+                            "Description"
+                    <entry>
                 <row>
                     <entry>
                         <paragraph>
-                            Albatr\u00b0\u00df
+                            "Albatr\u00b0\u00df"
                     <entry>
                         <paragraph>
                             2.99
                     <entry>
                         <paragraph>
-                            \u00a1On a \u03c3\u03c4\u03b9\u03ba!
+                            "\u00a1Ona\x03\xc3\x03\xc4\x03\xb9\x03\xba!"
+                    <entry>
                 <row>
                     <entry>
                         <paragraph>
-                            Crunchy Frog
+                            "CrunchyFrog"
                     <entry>
                         <paragraph>
                             1.49
                     <entry>
                         <paragraph>
-                            If we took the b\u00f6nes out, it wouldn\u2019t be
-                            crunchy, now would it?
+                            "Ifwetooktheb\u00f6nesout
+                    <entry>
+                        <paragraph>
+                            itwouldn\x20\x19tbe
                 <row>
                     <entry>
                         <paragraph>
-                            Gannet Ripple
+                            crunchy
+                    <entry>
+                        <paragraph>
+                            nowwouldit?"
+                    <entry>
+                    <entry>
+                <row>
+                    <entry>
+                        <paragraph>
+                            "GannetRipple"
                     <entry>
                         <paragraph>
                             1.99
                     <entry>
                         <paragraph>
-                            \u00bfOn a \u03c3\u03c4\u03b9\u03ba?
+                            "\xbfOna\x03\xc3\x03\xc4\x03\xb9\x03\xba?"
+                    <entry>
     <paragraph>
         (7- and 8-bit text encoded as UTF-16 has lots of null/zero bytes.)
-""" % (null_bytes_exception, utf_16_csv)
+"""
 else:
     bad_encoding_result = """\
 <document source="test data">
-- 
2.11.4.GIT