-
-
Notifications
You must be signed in to change notification settings - Fork 42
Expand file tree
/
Copy pathtest_deprecated.py
More file actions
38 lines (28 loc) · 1022 Bytes
/
test_deprecated.py
File metadata and controls
38 lines (28 loc) · 1022 Bytes
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
"""Test deprecated features."""
from __future__ import annotations
import numpy as np
import pytest
import tcod
import tcod.event
import tcod.libtcodpy
with pytest.warns():
import libtcodpy
# ruff: noqa: D103
@pytest.mark.filterwarnings("error")
def test_deprecate_color() -> None:
with pytest.raises(FutureWarning, match=r".*\(0, 0, 0\)"):
_ = tcod.black
with pytest.raises(FutureWarning, match=r".*\(0, 0, 0\)"):
_ = tcod.libtcodpy.black
with pytest.raises(FutureWarning, match=r".*\(0, 0, 0\)"):
_ = libtcodpy.black
@pytest.mark.filterwarnings("error")
def test_deprecate_key_constants() -> None:
with pytest.raises(FutureWarning, match=r".*KeySym.N1"):
_ = tcod.event.K_1
with pytest.raises(FutureWarning, match=r".*Scancode.N1"):
_ = tcod.event.SCANCODE_1
def test_line_where() -> None:
with pytest.warns():
where = tcod.libtcodpy.line_where(1, 0, 3, 4)
np.testing.assert_array_equal(where, [[1, 1, 2, 2, 3], [0, 1, 2, 3, 4]])