-
Notifications
You must be signed in to change notification settings - Fork 58
/
test_vis.py
37 lines (31 loc) · 1.32 KB
/
test_vis.py
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
"""Test the visibility module."""
import pytest
from click.testing import CliRunner
from awpy.cli import get
from awpy.vis import is_visible
class TestVisibility:
"""Tests the Awpy calculation functions."""
@pytest.fixture(autouse=True)
def setup_runner(self): # noqa: PT004
"""Setup CLI runner."""
self.runner = CliRunner()
self.runner.invoke(get, ["usd", "de_dust2"])
def test_basic_visibility(self):
"""Tests basic visibility for de_dust2."""
ct_spawn_pos = (15, 2168, -65)
t_spawn_pos_1 = (-680, 834, 180)
t_spawn_pos_2 = (-1349, 814, 180)
mid_doors_ct = (-485.90, 1737.51, -60.28)
mid_doors_t = (-489.97, 1532.02, -61.08)
ct_spawn_towards_b = (-670.19, 2253.08, -56.78)
long_a_near_site = (1320.44, 2012.22, 61.44)
assert is_visible(t_spawn_pos_1, t_spawn_pos_2, "de_dust2")
assert is_visible(
t_spawn_pos_2, t_spawn_pos_1, "de_dust2"
) # Test the flipped version
assert not is_visible(t_spawn_pos_1, ct_spawn_pos, "de_dust2")
assert not is_visible(
ct_spawn_pos, t_spawn_pos_1, "de_dust2"
) # Test the flipped version
assert not is_visible(mid_doors_ct, mid_doors_t, "de_dust2")
assert is_visible(ct_spawn_towards_b, long_a_near_site, "de_dust2")