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
|
From: Colin Watson <cjwatson@debian.org>
Date: Wed, 13 Nov 2024 11:50:38 +0000
Subject: Fix tests on Python 3.13
The previously-expected messages and indexes were changed by
https://github.com/python/cpython/pull/113227.
Fixes: #55
Forwarded: https://github.com/domdfcoding/singledispatch-json/pull/56
Bug: https://github.com/domdfcoding/singledispatch-json/issues/55
Bug-Debian: https://bugs.debian.org/1082269
Last-Update: 2024-11-13
---
tests/stdlib_tests/test_fail.py | 21 ++++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)
diff --git a/tests/stdlib_tests/test_fail.py b/tests/stdlib_tests/test_fail.py
index 072f539..1b76a1a 100644
--- a/tests/stdlib_tests/test_fail.py
+++ b/tests/stdlib_tests/test_fail.py
@@ -162,11 +162,21 @@ def test_truncated_input(data: str, msg: str, idx: int):
('{"spam":[}', unexpected_right_brace, 9),
("[42:", unexpected_colon, 3),
('[42 "spam"', "Unexpected '\"' when decoding array" if PYPY else "Expecting ',' delimiter", 4),
- ("[42,]", "Unexpected ']'" if PYPY else "Expecting value", 4),
+ (
+ "[42,]",
+ "Unexpected ']'" if PYPY else "Illegal trailing comma before end of array"
+ if sys.version_info >= (3, 13) else "Expecting value",
+ 3 if sys.version_info >= (3, 13) else 4
+ ),
('{"spam":[42}', "Unexpected '}' when decoding array" if PYPY else "Expecting ',' delimiter", 11),
('["]', "Unterminated string starting at", 1),
('["spam":', unexpected_colon, 7),
- ('["spam",]', "Unexpected ']'" if PYPY else "Expecting value", 8),
+ (
+ '["spam",]',
+ "Unexpected ']'" if PYPY else "Illegal trailing comma before end of array"
+ if sys.version_info >= (3, 13) else "Expecting value",
+ 7 if sys.version_info >= (3, 13) else 8
+ ),
("{:", property_name_string, 1),
("{,", property_name_string, 1),
("{42", property_name_string, 1),
@@ -182,7 +192,12 @@ def test_truncated_input(data: str, msg: str, idx: int):
11
),
('[{"spam":42]', "Unexpected ']' when decoding object" if PYPY else "Expecting ',' delimiter", 11),
- ('{"spam":42,}', property_name_string, 11),
+ (
+ '{"spam":42,}',
+ "Illegal trailing comma before end of object"
+ if sys.version_info >= (3, 13) else property_name_string,
+ 10 if sys.version_info >= (3, 13) else 11
+ ),
]
)
def test_unexpected_data(data: str, msg: str, idx: int):
|