1818from tcod import libtcodpy
1919
2020
21- def raise_Exception (* _args : object ) -> NoReturn :
21+ def raise_exception (* _args : object ) -> NoReturn :
2222 raise RuntimeError ("testing exception" ) # noqa: TRY003, EM101
2323
2424
2525def test_line_error () -> None :
2626 """Test exception propagation."""
2727 with pytest .raises (RuntimeError ), pytest .warns ():
28- libtcodpy .line (0 , 0 , 10 , 10 , py_callback = raise_Exception )
28+ libtcodpy .line (0 , 0 , 10 , 10 , py_callback = raise_exception )
2929
3030
3131@pytest .mark .filterwarnings ("ignore:Iterate over nodes using" )
@@ -39,7 +39,7 @@ def test_tcod_bsp() -> None:
3939 assert not bsp .children
4040
4141 with pytest .raises (RuntimeError ):
42- libtcodpy .bsp_traverse_pre_order (bsp , raise_Exception )
42+ libtcodpy .bsp_traverse_pre_order (bsp , raise_exception )
4343
4444 bsp .split_recursive (3 , 4 , 4 , 1 , 1 )
4545 for node in bsp .walk ():
@@ -102,7 +102,7 @@ def test_tcod_map_pickle() -> None:
102102def test_tcod_map_pickle_fortran () -> None :
103103 map_ = tcod .map .Map (2 , 3 , order = "F" )
104104 map2 : tcod .map .Map = pickle .loads (pickle .dumps (copy .copy (map_ )))
105- assert map_ ._Map__buffer .strides == map2 ._Map__buffer .strides # type: ignore
105+ assert map_ ._Map__buffer .strides == map2 ._Map__buffer .strides # type: ignore[attr-defined]
106106 assert map_ .transparent .strides == map2 .transparent .strides
107107 assert map_ .walkable .strides == map2 .walkable .strides
108108 assert map_ .fov .strides == map2 .fov .strides
@@ -148,7 +148,7 @@ def test_path_numpy(dtype: DTypeLike) -> None:
148148 tcod .path .AStar (np .ones ((2 , 2 ), dtype = np .float64 ))
149149
150150
151- def path_cost (this_x : int , this_y : int , dest_x : int , dest_y : int ) -> bool :
151+ def path_cost (_this_x : int , _this_y : int , _dest_x : int , _dest_y : int ) -> bool :
152152 return True
153153
154154
@@ -160,7 +160,7 @@ def test_path_callback() -> None:
160160
161161
162162def test_key_repr () -> None :
163- Key = libtcodpy .Key
163+ Key = libtcodpy .Key # noqa: N806
164164 key = Key (vk = 1 , c = 2 , shift = True )
165165 assert key .vk == 1
166166 assert key .c == 2 # noqa: PLR2004
@@ -172,7 +172,7 @@ def test_key_repr() -> None:
172172
173173
174174def test_mouse_repr () -> None :
175- Mouse = libtcodpy .Mouse
175+ Mouse = libtcodpy .Mouse # noqa: N806
176176 mouse = Mouse (x = 1 , lbutton = True )
177177 mouse_copy = eval (repr (mouse )) # noqa: S307
178178 assert mouse .x == mouse_copy .x
@@ -185,22 +185,22 @@ def test_cffi_structs() -> None:
185185
186186
187187@pytest .mark .filterwarnings ("ignore" )
188- def test_recommended_size (console : tcod .console .Console ) -> None :
188+ def test_recommended_size (console : tcod .console .Console ) -> None : # noqa: ARG001
189189 tcod .console .recommended_size ()
190190
191191
192192@pytest .mark .filterwarnings ("ignore" )
193- def test_context (uses_window : None ) -> None :
193+ def test_context (uses_window : None ) -> None : # noqa: ARG001
194194 with tcod .context .new_window (32 , 32 , renderer = libtcodpy .RENDERER_SDL2 ):
195195 pass
196- WIDTH , HEIGHT = 16 , 4
197- with tcod .context .new_terminal (columns = WIDTH , rows = HEIGHT , renderer = libtcodpy .RENDERER_SDL2 ) as context :
196+ width , height = 16 , 4
197+ with tcod .context .new_terminal (columns = width , rows = height , renderer = libtcodpy .RENDERER_SDL2 ) as context :
198198 console = tcod .console .Console (* context .recommended_console_size ())
199199 context .present (console )
200200 assert context .sdl_window_p is not None
201201 assert context .renderer_type >= 0
202202 context .change_tileset (tcod .tileset .Tileset (16 , 16 ))
203203 context .pixel_to_tile (0 , 0 )
204204 context .pixel_to_subtile (0 , 0 )
205- with pytest .raises (RuntimeError , match = ".*context has been closed" ):
205+ with pytest .raises (RuntimeError , match = r ".*context has been closed" ):
206206 context .present (console )
0 commit comments