summaryrefslogtreecommitdiff
path: root/dev-python/docutils/files/docutils-0.18.1-py311.patch
blob: 878c6f1961db8b5793b8bdcb36dff5fed60c9b5c (plain)
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
Combination of:
http://svn.code.sf.net/p/docutils/code/trunk@8910
http://svn.code.sf.net/p/docutils/code/trunk@8909

diff --git a/test/DocutilsTestSupport.py b/test/DocutilsTestSupport.py
index 592d3f9df..e1f33aa7a 100644
--- a/test/DocutilsTestSupport.py
+++ b/test/DocutilsTestSupport.py
@@ -819,6 +819,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..73724ed7e 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,92 @@ 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">
+    <table>
+        <title>
+            bad encoding
+        <tgroup cols="4">
+            <colspec colwidth="25">
+            <colspec colwidth="25">
+            <colspec colwidth="25">
+            <colspec colwidth="25">
+            <tbody>
+                <row>
+                    <entry>
+                        <paragraph>
+                            \xfe\xff"Treat"
+                    <entry>
+                        <paragraph>
+                            "Quantity"
+                    <entry>
+                        <paragraph>
+                            "Description"
+                    <entry>
+                <row>
+                    <entry>
+                        <paragraph>
+                            "Albatr\u00b0\u00df"
+                    <entry>
+                        <paragraph>
+                            2.99
+                    <entry>
+                        <paragraph>
+                            "\u00a1Ona\x03\xc3\x03\xc4\x03\xb9\x03\xba!"
+                    <entry>
+                <row>
+                    <entry>
+                        <paragraph>
+                            "CrunchyFrog"
+                    <entry>
+                        <paragraph>
+                            1.49
+                    <entry>
+                        <paragraph>
+                            "Ifwetooktheb\u00f6nesout
+                    <entry>
+                        <paragraph>
+                            itwouldn\x20\x19tbe
+                <row>
+                    <entry>
+                        <paragraph>
+                            crunchy
+                    <entry>
+                        <paragraph>
+                            nowwouldit?"
+                    <entry>
+                    <entry>
+                <row>
+                    <entry>
+                        <paragraph>
+                            "GannetRipple"
+                    <entry>
+                        <paragraph>
+                            1.99
+                    <entry>
+                        <paragraph>
+                            "\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.)
+"""
+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 +1117,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