22import pickle
33import re
44import timeit
5+ from typing import Any
56
67import pytest
78
@@ -201,7 +202,7 @@ def test_tuplemanager_bare_string_raises_typeerror(self) -> None:
201202 # sequence element #0 has length 1; 2 is required" naming no argument
202203 # and suggesting no fix (#242)
203204 with pytest .raises (TypeError , match = r"wrap it in a list" ):
204- TupleManager ('ab' )
205+ TupleManager ('ab' ) # type: ignore[arg-type]
205206
206207 def test_tuplemanager_bytes_raises_with_decode_hint (self ) -> None :
207208 with pytest .raises (TypeError , match = r"decode it first" ):
@@ -211,11 +212,11 @@ def test_tuplemanager_string_element_raises_typeerror(self) -> None:
211212 # the silent variant: an iterable of 2-character strings is a valid
212213 # dict-update sequence, so each one shreds into a key/value pair
213214 with pytest .raises (TypeError , match = r"key and a value" ):
214- TupleManager (['ab' , 'cd' ])
215+ TupleManager (['ab' , 'cd' ]) # type: ignore[arg-type]
215216
216217 def test_constants_capitalization_exceptions_string_elements_raise (self ) -> None :
217218 with pytest .raises (TypeError , match = r"key and a value" ):
218- Constants (capitalization_exceptions = ['ii' ])
219+ Constants (capitalization_exceptions = ['ii' ]) # type: ignore[list-item]
219220
220221 def test_tuplemanager_accepts_mapping_and_pairs (self ) -> None :
221222 # the guard must not reject the two legitimate constructor shapes
@@ -300,7 +301,7 @@ def test_clear_removes_all_entries(self) -> None:
300301
301302 def test_empty_attribute_default (self ) -> None :
302303 from nameparser .config import CONSTANTS
303- CONSTANTS .empty_attribute_default = None
304+ CONSTANTS .empty_attribute_default = None # type: ignore[assignment]
304305 hn = HumanName ("" )
305306 self .m (hn .title , None , hn )
306307 self .m (hn .first , None , hn )
@@ -311,7 +312,7 @@ def test_empty_attribute_default(self) -> None:
311312
312313 def test_empty_attribute_on_instance (self ) -> None :
313314 hn = HumanName ("" , None )
314- hn .C .empty_attribute_default = None
315+ hn .C .empty_attribute_default = None # type: ignore[assignment]
315316 self .m (hn .title , None , hn )
316317 self .m (hn .first , None , hn )
317318 self .m (hn .middle , None , hn )
@@ -321,7 +322,7 @@ def test_empty_attribute_on_instance(self) -> None:
321322
322323 def test_none_empty_attribute_string_formatting (self ) -> None :
323324 hn = HumanName ("" , None )
324- hn .C .empty_attribute_default = None
325+ hn .C .empty_attribute_default = None # type: ignore[assignment]
325326 self .assertEqual ('' , str (hn ), hn )
326327
327328 def test_add_constant_with_explicit_encoding (self ) -> None :
@@ -360,7 +361,7 @@ def test_pickle_roundtrip_preserves_customizations(self) -> None:
360361 def test_pickle_roundtrip_preserves_instance_scalar_override (self ) -> None :
361362 """An instance-level scalar override must survive a pickle round-trip."""
362363 c = Constants ()
363- c .empty_attribute_default = None
364+ c .empty_attribute_default = None # type: ignore[assignment]
364365
365366 # Safe: round-tripping a Constants the test just built, not untrusted data.
366367 restored = pickle .loads (pickle .dumps (c ))
@@ -729,7 +730,7 @@ def _config_snapshot(constants: Constants) -> dict:
729730 added to ``Constants`` later is watched automatically, with no
730731 attribute list to keep in sync.
731732 """
732- snap = {}
733+ snap : dict [ str , Any ] = {}
733734 for attr , value in constants .__getstate__ ().items ():
734735 if isinstance (value , SetManager ):
735736 snap [attr ] = set (value )
0 commit comments