Implement tests.
This commit is contained in:
@@ -1,26 +1,45 @@
|
||||
import os
|
||||
"""
|
||||
AuDaGe XSY tests
|
||||
|
||||
from pandas import DataFrame
|
||||
name: test_xsy.py
|
||||
by: Josh Lucas
|
||||
date: 2026-09-14
|
||||
|
||||
desc: Unit tests for the AuDaGe XSY module.
|
||||
"""
|
||||
|
||||
import os
|
||||
import unittest
|
||||
from timeit import default_timer as timer
|
||||
|
||||
# from pandas import DataFrame
|
||||
|
||||
from AuDaGe.formats.controlexpert.xsy import XSY
|
||||
|
||||
def test_init():
|
||||
assert isinstance(XSY("tests/data/hsps.xsy"), XSY)
|
||||
IN_PATH = "tests/assets"
|
||||
OUT_PATH = "tests/output"
|
||||
|
||||
def test_export():
|
||||
xsy = XSY()
|
||||
datablock = xsy.read("tests/data/hsps.xsy", expand=False)
|
||||
print(xsy.def_paths)
|
||||
out_path = "tests/output"
|
||||
datablock.to_csv(
|
||||
os.path.join(out_path, "datablock.csv"),
|
||||
index=False
|
||||
)
|
||||
xsy.defs.to_csv(
|
||||
os.path.join(out_path, "defs.csv"),
|
||||
index=False
|
||||
)
|
||||
xsy.expand_datablock(datablock).to_csv(
|
||||
os.path.join(out_path, "expanded.csv"),
|
||||
index=False
|
||||
)
|
||||
class TestXSY(unittest.TestCase):
|
||||
|
||||
def test_init(self):
|
||||
assert isinstance(XSY(os.path.join(IN_PATH, "hsps.xsy")), XSY)
|
||||
|
||||
def test_export(self):
|
||||
xsy = XSY()
|
||||
xsy.read(os.path.join(IN_PATH, "hsps.xsy"), expand=False)
|
||||
xsy.datablock.to_csv(
|
||||
os.path.join(OUT_PATH, "datablock.csv"),
|
||||
index=False
|
||||
)
|
||||
xsy.definitions.to_csv(
|
||||
os.path.join(OUT_PATH, "defs.csv"),
|
||||
index=False
|
||||
)
|
||||
# xsy.expand_datablock(datablock).to_csv(
|
||||
# os.path.join(OUT_PATH, "expanded.csv"),
|
||||
# index=False
|
||||
# )
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main(failfast=True)
|
||||
Reference in New Issue
Block a user