8000 Update tests to account for changed JSON error message in Python 3.13 · python-formate/snippet-fmt@b2ee0a2 · GitHub
[go: up one dir, main page]

Skip to content

Commit b2ee0a2

Browse files
committed
Update tests to account for changed JSON error message in Python 3.13
1 parent 9781405 commit b2ee0a2

File tree

65 files changed

+4915
-2
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+4915
-2
lines changed

tests/test_snippet_fmt.py

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from _pytest.capture import CaptureResult
88
from coincidence import AdvancedDataRegressionFixture, AdvancedFileRegressionFixture
99
from coincidence.params import param
10+
from coincidence.selectors import max_version, min_version
1011
from consolekit.terminal_colours import strip_ansi
1112
from consolekit.testing import CliRunner, Result
1213
from domdf_python_tools.paths import PathPlus, TemporaryPathPlus, in_directory
@@ -52,15 +53,33 @@
5253
{"ini": {"reformat": True}, "python": {"reformat": False}},
5354
id="ini_python_false",
5455
),
55-
pytest.param({"JSON": {"reformat": True}}, id="json_caps"),
56-
pytest.param({"json": {"reformat": True}}, id="json"),
56+
pytest.param({"JSON": {"reformat": True}}, id="json_caps", marks=max_version("3.12")),
57+
pytest.param(
58+
{"JSON": {"reformat": True}},
59+
id="json_caps_new_error_msg",
60+
marks=min_version("3.13"),
61+
),
62+
pytest.param({"json": {"reformat": True}}, id="json", marks=max_version("3.12")),
63+
pytest.param({"json": {"reformat": True}}, id="json_new_error_msg", marks=min_version("3.13")),
5764
pytest.param(
5865
{"JSON": {"reformat": True, "indent": 2}, "json": {"reformat": True}},
5966
id="json_caps_indent",
67+
marks=max_version("3.12"),
68+
),
69+
pytest.param(
70+
{"JSON": {"reformat": True, "indent": 2}, "json": {"reformat": True}},
71+
id="json_caps_indent_new_error_msg",
72+
marks=min_version("3.13"),
6073
),
6174
pytest.param(
6275
{"json": {"reformat": True, "indent": 2}, "JSON": {"reformat": True}},
6376
id="json_indent",
77+
marks=max_version("3.12"),
78+
),
79+
pytest.param(
80+
{"json": {"reformat": True, "indent": 2}, "JSON": {"reformat": True}},
81+
id="json_indent_new_error_msg",
82+
marks=min_version("3.13"),
6483
),
6584
]
6685
)
Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
2+
.. code-block:: python
3+
4+
print ( 'Hello World'
5+
6+
)
7+
8+
for item in [a,b,c] :
9+
if item: print(item)
10+
11+
12+
.. code-block:: python3
13+
14+
print ( 'Hello World'
15+
16+
)
17+
18+
for item in [a,b,c] :
19+
if item: print(item)
20+
21+
22+
.. code-block:: python3
23+
24+
for item in [a,b,c] :
25+
if item: print(item)
26+
27+
28+
.. code-cell:: python3
29+
:count: 1
30+
31+
print ( 'Hello World'
32+
33+
)
34+
35+
for item in [a,b,c] :
36+
if item: print(item)
37+
38+
39+
.. code:: python
40+
41+
print ( 'Hello World'
42+
43+
)
44+
45+
for item in [a,b,c] :
46+
if item: print(item)
47+
48+
49+
.. sourcecode:: python
50+
51+
print ( 'Hello World'
52+
53+
)
54+
55+
for item in [a,b,c] :
56+
if item: print(item)
57+
58+
59+
.. parsed-literal:: python
60+
61+
print ( 'Hello World'
62+
63+
)
64+
65+
for item in [a,b,c] :
66+
if item: print(item)
67+
68+
69+
.. code-block:: toml
70+
71+
[project]
72+
73+
74+
name = 'my-project'
75+
76+
77+
version="1.2.3"
78+
license = {file = "LICENSE"}
79+
80+
81+
.. code-block:: TOML
82+
83+
[project]
84+
85+
86+
name = 'my-project'
87+
88+
89+
version="1.2.3"
90+
license = {file = "LICENSE"}
91+
92+
93+
.. code:: TOML
94+
95+
[project]
96+
97+
98+
name = 'my-project'
99+
100+
101+
version="1.2.3"
102+
license = {
103+
file = "LICENSE",
104+
}
105+
106+
.. sourcecode:: toml
107+
108+
[project]
109+
name = 'my-project
110+
111+
112+
.. code-block:: JSON
113+
114+
{
115+
"key": "value",
116+
"key2": "value2",
117+
}
118+
119+
.. code-block:: json
120+
121+
{"key": "value", "key2": "value2"}
122+
123+
124+
.. code-block:: bash
125+
126+
echo "Hello World"
127+
128+
129+
.. code:: YAML
130+
131+
name: my-project
132+
version: 1.2.3
133+
134+
.. a-directive::
135+
136+
.. code-block:: json
137+
138+
{"key": "value", "key2": "value2"}
139+
140+
.. code-block:: bash
141+
142+
$ conda config --add channels https://conda.anaconda.org/conda-forge
143+
$ conda config --add channels https://conda.anaconda.org/domdfcoding
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
err:
2+
- '.../example.rst:112: JSONDecodeError: Illegal trailing comma before end of object:
3+
line 3 column 18 (char 36)'
4+
- ''
5+
out:
6+
- ''
Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
2+
.. code-block:: python
3+
4+
print ( 'Hello World'
5+
6+
)
7+
8+
for item in [a,b,c] :
9+
if item: print(item)
10+
11+
12+
.. code-block:: python3
13+
14+
print ( 'Hello World'
15+
16+
)
17+
18+
for item in [a,b,c] :
19+
if item: print(item)
20+
21+
22+
.. code-block:: python3
23+
24+
for item in [a,b,c] :
25+
if item: print(item)
26+
27+
28+
.. code-cell:: python3
29+
:count: 1
30+
31+
print ( 'Hello World'
32+
33+
)
34+
35+
for item in [a,b,c] :
36+
if item: print(item)
37+
38+
39+
.. code:: python
40+
41+
print ( 'Hello World'
42+
43+
)
44+
45+
for item in [a,b,c] :
46+
if item: print(item)
47+
48+
49+
.. sourcecode:: python
50+
51+
print ( 'Hello World'
52+
53+
)
54+
55+
for item in [a,b,c] :
56+
if item: print(item)
57+
58+
59+
.. parsed-literal:: python
60+
61+
print ( 'Hello World'
62+
63+
)
64+
65+
for item in [a,b,c] :
66+
if item: print(item)
67+
68+
69+
.. code-block:: toml
70+
71+
[project]
72+
73+
74+
name = 'my-project'
75+
76+
77+
version="1.2.3"
78+
license = {file = "LICENSE"}
79+
80+
81+
.. code-block:: TOML
82+
83+
[project]
84+
85+
86+
name = 'my-project'
87+
88+
89+
version="1.2.3"
90+
license = {file = "LICENSE"}
91+
92+
93+
.. code:: TOML
94+
95+
[project]
96+
97+
98+
name = 'my-project'
99+
100+
101+
version="1.2.3"
102+
license = {
103+
file = "LICENSE",
104+
}
105+
106+
.. sourcecode:: toml
107+
108+
[project]
109+
name = 'my-project
110+
111+
112+
.. code-block:: JSON
113+
114+
{
115+
"key": "value",
116+
"key2": "value2",
117+
}
118+
119+
.. code-block:: json
120+
121+
{"key": "value", "key2": "value2"}
122+
123+
124+
.. code-block:: bash
125+
126+
echo "Hello World"
127+
128+
129+
.. code:: YAML
130+
131+
name: my-project
132+
version: 1.2.3
133+
134+
.. a-directive::
135+
136+
.. code-block:: json
137+
138+
{"key": "value", "key2": "value2"}
139+
140+
.. code-block:: bash
141+
142+
$ conda config --add channels https://conda.anaconda.org/conda-forge
143+
$ conda config --add channels https://conda.anaconda.org/domdfcoding
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
err:
2+
- ''
3+
out:
4+
- ''

0 commit comments

Comments
 (0)
0