@@ -26,26 +26,29 @@ def assert_char(console, x, y, ch=None, fg=None, bg=None):
2626 ch = ord (ch )
2727 except TypeError :
2828 pass
29- assert libtcodpy . console_get_char ( console , x , y ) == ch
29+ assert console . ch [ y , x ] == ch
3030 if fg is not None :
31- assert libtcodpy . console_get_char_foreground (console , x , y ) == fg
31+ assert (console . fg [ y , x ] == fg ). all ()
3232 if bg is not None :
33- assert libtcodpy . console_get_char_background (console , x , y ) == bg
33+ assert (console . bg [ y , x ] == bg ). all ()
3434
3535def test_console_defaults (console , fg , bg ):
3636 libtcodpy .console_set_default_foreground (console , fg )
3737 libtcodpy .console_set_default_background (console , bg )
3838 libtcodpy .console_clear (console )
3939 assert_char (console , 0 , 0 , None , fg , bg )
4040
41+ @pytest .mark .filterwarnings ("ignore:Directly access a consoles" )
4142def test_console_set_char_background (console , bg ):
4243 libtcodpy .console_set_char_background (console , 0 , 0 , bg , libtcodpy .BKGND_SET )
4344 assert_char (console , 0 , 0 , bg = bg )
4445
46+ @pytest .mark .filterwarnings ("ignore:Directly access a consoles" )
4547def test_console_set_char_foreground (console , fg ):
4648 libtcodpy .console_set_char_foreground (console , 0 , 0 , fg )
4749 assert_char (console , 0 , 0 , fg = fg )
4850
51+ @pytest .mark .filterwarnings ("ignore:Directly access a consoles" )
4952def test_console_set_char (console , ch ):
5053 libtcodpy .console_set_char (console , 0 , 0 , ch )
5154 assert_char (console , 0 , 0 , ch = ch )
@@ -100,15 +103,12 @@ def test_console_fade(console):
100103 libtcodpy .console_get_fade ()
101104 libtcodpy .console_get_fading_color ()
102105
106+
103107def assertConsolesEqual (a , b ):
104- for y in range (libtcodpy .console_get_height (a )):
105- for x in range (libtcodpy .console_get_width (a )):
106- assert libtcodpy .console_get_char (a , x , y ) == \
107- libtcodpy .console_get_char (b , x , y )
108- assert libtcodpy .console_get_char_foreground (a , x , y ) == \
109- libtcodpy .console_get_char_foreground (b , x , y )
110- assert libtcodpy .console_get_char_background (a , x , y ) == \
111- libtcodpy .console_get_char_background (b , x , y )
108+ return ((a .fg [:] == b .fg [:]).all () and
109+ (a .bg [:] == b .bg [:]).all () and
110+ (a .ch [:] == b .ch [:]).all ())
111+
112112
113113def test_console_blit (console , offscreen ):
114114 libtcodpy .console_print (offscreen , 0 , 0 , 'test' )
@@ -132,6 +132,7 @@ def test_console_apf_read_write(console, offscreen, tmpdir):
132132 assert libtcodpy .console_load_apf (offscreen , apf_file )
133133 assertConsolesEqual (console , offscreen )
134134
135+ @pytest .mark .filterwarnings ("ignore:Directly access a consoles" )
135136def test_console_rexpaint_load_test_file (console ):
136137 xp_console = libtcodpy .console_from_xp ('libtcod/data/rexpaint/test.xp' )
137138 assert xp_console
@@ -180,6 +181,7 @@ def test_console_fill_errors(console):
180181 with pytest .raises (TypeError ):
181182 libtcodpy .console_fill_foreground (console , [0 ], [], [])
182183
184+ @pytest .mark .filterwarnings ("ignore:Directly access a consoles" )
183185def test_console_fill (console ):
184186 width = libtcodpy .console_get_width (console )
185187 height = libtcodpy .console_get_height (console )
@@ -200,6 +202,7 @@ def test_console_fill(console):
200202 assert fill == ch
201203
202204@pytest .mark .skipif (not numpy , reason = 'requires numpy module' )
205+ @pytest .mark .filterwarnings ("ignore:Directly access a consoles" )
203206def test_console_fill_numpy (console ):
204207 width = libtcodpy .console_get_width (console )
205208 height = libtcodpy .console_get_height (console )
@@ -225,6 +228,7 @@ def test_console_fill_numpy(console):
225228 assert fill == fg .tolist ()
226229 assert fill == ch .tolist ()
227230
231+ @pytest .mark .filterwarnings ("ignore:Console array attributes perform better" )
228232def test_console_buffer (console ):
229233 buffer = libtcodpy .ConsoleBuffer (
230234 libtcodpy .console_get_width (console ),
@@ -236,6 +240,7 @@ def test_console_buffer(console):
236240 buffer .set (0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , '@' )
237241 buffer .blit (console )
238242
243+ @pytest .mark .filterwarnings ("ignore:Console array attributes perform better" )
239244def test_console_buffer_error (console ):
240245 buffer = libtcodpy .ConsoleBuffer (0 , 0 )
241246 with pytest .raises (ValueError ):
@@ -253,6 +258,7 @@ def test_mouse(console):
253258 repr (mouse )
254259 libtcodpy .mouse_move (0 , 0 )
255260
261+ @pytest .mark .filterwarnings ("ignore:Use Python's standard 'time' module" )
256262def test_sys_time (console ):
257263 libtcodpy .sys_set_fps (0 )
258264 libtcodpy .sys_get_fps ()
@@ -307,6 +313,7 @@ def test_image(console, tmpdir):
307313
308314@pytest .mark .parametrize ('sample' , ['@' , u'\u2603 ' ]) # Unicode snowman
309315@pytest .mark .xfail (reason = 'Unreliable' )
316+ @pytest .mark .filterwarnings ("ignore:This function does not provide reliable" )
310317def test_clipboard (console , sample ):
311318 saved = libtcodpy .sys_clipboard_get ()
312319 try :
0 commit comments