fix sprites fixture with simpler nested for loops

This commit is contained in:
Xevion
2020-04-20 23:53:39 -05:00
parent a73b858474
commit 6c5c1e735c

View File

@@ -4,7 +4,6 @@ A file dedicated to testing our game and ensuring it can run.
Integrate this into your IDE's workflow to ensure the game runs from top to bottom. Integrate this into your IDE's workflow to ensure the game runs from top to bottom.
The tests used here should test all of our game's features as best they can. The tests used here should test all of our game's features as best they can.
""" """
from itertools import chain
from typing import Pattern, List from typing import Pattern, List
import pytest import pytest
@@ -48,12 +47,11 @@ class TestSprites:
BASE_DIR = os.path.dirname(os.path.abspath(__file__)) BASE_DIR = os.path.dirname(os.path.abspath(__file__))
IMAGE_DIR = os.path.join(BASE_DIR, 'resources', 'images') IMAGE_DIR = os.path.join(BASE_DIR, 'resources', 'images')
primary_folders = os.listdir(IMAGE_DIR) _sprites = []
secondary_folders = \ for primary in os.listdir(IMAGE_DIR):
chain.from_iterable([os.listdir(os.path.join(IMAGE_DIR, pfolder)) for pfolder in primary_folders])[os.listdir()] for secondary in os.listdir(os.path.join(IMAGE_DIR, primary)):
return list( _sprites.extend(os.listdir(os.path.join(IMAGE_DIR, primary, secondary)))
chain.from_iterable([[os.path.join(IMAGE_DIR, file) for file in os.listdir(os.path.join(IMAGE_DIR, folder)) return _sprites
] for folder in os.listdir(IMAGE_DIR)]))
@pytest.fixture @pytest.fixture
def patterns(self) -> List[Pattern]: def patterns(self) -> List[Pattern]: