-
-
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) added
ion_storm.Dat
tests
- Loading branch information
1 parent
9d3bdf8
commit 330a4c7
Showing
1 changed file
with
27 additions
and
0 deletions.
There are no files selected for viewing
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,27 @@ | ||
import fnmatch | ||
import os | ||
|
||
import pytest | ||
|
||
from bsp_tool.archives import ion_storm | ||
|
||
from ... import utils | ||
|
||
|
||
dats = dict() | ||
archive = utils.archive_dirs() | ||
if archive.steam_dir is not None: | ||
ax_dir = os.path.join(archive.steam_dir, "Anachronox/anoxdata") | ||
dats = { | ||
f"Anachronox | {dat_filename}": os.path.join(ax_dir, dat_filename) | ||
for dat_filename in fnmatch.filter(os.listdir(ax_dir), "*.dat")} | ||
|
||
|
||
@pytest.mark.parametrize("filename", dats.values(), ids=dats.keys()) | ||
def test_from_file(filename: str): | ||
dat = ion_storm.Dat.from_file(filename) | ||
namelist = dat.namelist() | ||
assert isinstance(namelist, list), ".namelist() failed" | ||
if len(namelist) != 0: | ||
first_file = dat.read(namelist[0]) | ||
assert isinstance(first_file, bytes), ".read() failed" |