Skip to content

Commit daf522b

Browse files
committed
Add rounding to world tests
1 parent 471ea06 commit daf522b

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

tests/test_world.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import pytest
77

8-
from pytiled_parser import world
8+
from pytiled_parser import OrderedPair, world
99

1010
TESTS_DIR = Path(os.path.dirname(os.path.abspath(__file__)))
1111
TEST_DATA = TESTS_DIR / "test_data"
@@ -18,6 +18,16 @@
1818
]
1919

2020

21+
def fix_world_map(world_map):
22+
world_map.coordinates = OrderedPair(
23+
round(world_map.coordinates[0], 3), round(world_map.coordinates[1], 3)
24+
)
25+
26+
27+
def fix_world(world):
28+
for world_map in world.maps:
29+
fix_world_map(world_map)
30+
2131
@pytest.mark.parametrize("world_test", ALL_WORLD_TESTS)
2232
def test_world_integration(world_test):
2333
# it's a PITA to import like this, don't do it
@@ -31,5 +41,6 @@ def test_world_integration(world_test):
3141
raw_world_path = world_test / "world.world"
3242

3343
casted_world = world.parse_world(raw_world_path)
44+
fix_world(casted_world)
3445

3546
assert casted_world == expected.EXPECTED

0 commit comments

Comments
 (0)