4
4
import sys
5
5
from collections import OrderedDict
6
6
from datetime import datetime , timedelta
7
+ from json import JSONDecodeError
7
8
from unittest import TestCase
8
9
from warnings import catch_warnings , warn
9
10
@@ -277,7 +278,7 @@ def test_assert_almost_equal__not_similar__delta__custom_message(self):
277
278
278
279
def test_assert_almost_equal__wrong_types (self ):
279
280
try :
280
- assert_almost_equal ("5" , "5" ) # type: ignore
281
+ assert_almost_equal ("5" , "5" ) # type: ignore[arg-type]
281
282
except TypeError :
282
283
pass
283
284
else :
@@ -370,7 +371,7 @@ def test_assert_not_almost_equal__similar__delta__custom_message(self):
370
371
371
372
def test_assert_not_almost_equal__wrong_types (self ):
372
373
try :
373
- assert_not_almost_equal ("5" , "5" ) # type: ignore
374
+ assert_not_almost_equal ("5" , "5" ) # type: ignore[arg-type]
374
375
except TypeError :
375
376
pass
376
377
else :
@@ -1460,10 +1461,6 @@ def test_assert_json_subset__second_is_unsupported_json_string(self):
1460
1461
assert_json_subset ({}, "42" )
1461
1462
1462
1463
def test_assert_json_subset__second_is_invalid_json_string (self ):
1463
- try :
1464
- from json import JSONDecodeError
1465
- except ImportError :
1466
- JSONDecodeError = ValueError # type: ignore
1467
1464
with assert_raises (JSONDecodeError ):
1468
1465
assert_json_subset ({}, "," )
1469
1466
@@ -1479,7 +1476,7 @@ def test_assert_json_subset__invalid_type(self):
1479
1476
with assert_raises_regex (
1480
1477
TypeError , "second must be dict, list, str, or bytes"
1481
1478
):
1482
- assert_json_subset ({}, 42 ) # type: ignore
1479
+ assert_json_subset ({}, 42 ) # type: ignore[arg-type]
1483
1480
1484
1481
def test_assert_json_subset__element_name_not_str (self ) -> None :
1485
1482
with assert_raises_regex (
0 commit comments