Skip to content

Commit

Permalink
Address review for test_pkg.py
Browse files Browse the repository at this point in the history
  • Loading branch information
ThanatosGit committed Jan 8, 2024
1 parent bb0a046 commit 1a0ac18
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions tests/formats/test_pkg.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,31 @@
import pytest
from construct import Container, ListContainer
from tests.test_lib import parse_and_build_compare

from mercury_engine_data_structures import dread_data, samus_returns_data
from mercury_engine_data_structures.formats.pkg import Pkg
from mercury_engine_data_structures.game_check import Game

_EMPTY_DREAD_PKG = (b'\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')

all_dread_pkg = [name for name in dread_data.all_name_to_asset_id().keys()
if name.endswith(".pkg")]

def test_compare_dread(dread_path):
pkg_files = [f for f in dread_path.rglob("*.pkg")]
for f in pkg_files:
parse_and_build_compare(
Pkg.construct_class(Game.DREAD), Game.DREAD, dread_path.joinpath(f)
)
all_sr_pkg = [name for name in samus_returns_data.all_name_to_asset_id().keys()
if name.endswith(".pkg")]

@pytest.mark.parametrize("pkg_path", all_dread_pkg)
def test_compare_dread(dread_path, pkg_path):
parse_and_build_compare(
Pkg.construct_class(Game.DREAD), Game.DREAD, dread_path.joinpath(pkg_path)
)

@pytest.mark.skip("Rebuilding vanilla pkg files is currently not supported for SR")
@pytest.mark.parametrize("pkg_path", all_sr_pkg)
def test_compare_sr(samus_returns_path, pkg_path):
parse_and_build_compare(
Pkg.construct_class(Game.SAMUS_RETURNS), Game.SAMUS_RETURNS, samus_returns_path.joinpath(pkg_path)
)

def test_build_empty_pkg():
pkg = Pkg(Container(files=ListContainer()), Game.DREAD)
Expand Down

0 comments on commit 1a0ac18

Please sign in to comment.