-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(tests.archives)(#194) Adding
infinity_ward.Iwd
tests
- Loading branch information
1 parent
1cc270a
commit a2c008f
Showing
2 changed files
with
28 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |