Skip to content

Commit

Permalink
(tests.archives)(#194) Adding infinity_ward.Iwd tests
Browse files Browse the repository at this point in the history
  • Loading branch information
snake-biscuits committed Sep 3, 2024
1 parent 1cc270a commit a2c008f
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
Empty file.
28 changes: 28 additions & 0 deletions tests/archives/infinity_ward/test_Iwd.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import pytest

from bsp_tool.archives import infinity_ward

from ... import files


iwd_dirs: files.LibraryGames
iwd_dirs = {
"Steam": {
"Call of Duty 2": ["Call of Duty 2/main/"]}}


library = files.game_library()
iwds = {
f"{section} | {game} | {short_path}": full_path
for section, game, paths in library.scan(iwd_dirs, "*.iwd")
for short_path, full_path in paths}


@pytest.mark.parametrize("filename", iwds.values(), ids=iwds.keys())
def test_from_file(filename: str):
iwd = infinity_ward.Iwd.from_file(filename)
namelist = iwd.namelist()
assert isinstance(namelist, list), ".namelist() failed"
if len(namelist) != 0:
first_file = iwd.read(namelist[0])
assert isinstance(first_file, bytes), ".read() failed"

0 comments on commit a2c008f

Please sign in to comment.