Add config-based database conversion.

This commit is contained in:
Joshua Lucas
2026-10-29 09:09:03 -05:00
parent 36636878bd
commit d5da5c6618
35 changed files with 8450 additions and 209 deletions

View File

@@ -18,7 +18,7 @@ try:
from tests import assets, output
except ImportError: # pragma: no cover
import assets # noqa: I001
import output
import output # ty: ignore[unresolved-import]
class TestXSY(unittest.TestCase):
@@ -30,13 +30,12 @@ class TestXSY(unittest.TestCase):
self.in_paths = [
file
for file in resources.files(assets).iterdir()
if os.path.splitext(file)[-1].lower() == ".xsy"
if os.path.splitext(str(file))[-1].lower() == ".xsy"
]
def test_DataBlock(self):
for in_path in self.in_paths:
datablock = DataBlock.from_file(in_path)
self.assertIsInstance(datablock, DataBlock)
datablock = XSYBlock.from_file(in_path)
self.assertIsInstance(datablock, XSYBlock)
def test_Definitions(self):
@@ -52,7 +51,7 @@ class TestXSYReader(unittest.TestCase):
self.in_paths = [
file
for file in resources.files(assets).iterdir()
if os.path.splitext(file)[-1].lower() == ".xsy"
if os.path.splitext(str(file))[-1].lower() == ".xsy"
]
self.out_path = resources.files(output)
@@ -66,7 +65,7 @@ class TestXSYReader(unittest.TestCase):
def test_export(self):
for path in self.in_paths:
file_name = os.path.splitext(os.path.split(path)[-1])[0]
file_name = os.path.splitext(os.path.split(str(path))[-1])[0]
xsy = self.xsy_reader.read(path, expand=False)
xsy.datablock.to_csv(
self.out_path.joinpath(f"{file_name}_datablock.csv"),
@@ -78,7 +77,9 @@ class TestXSYReader(unittest.TestCase):
)
debug = False
for debug_step in (
XSY.DebugStep if debug else [XSY.DebugStep.COMPLETE]
XSY.DebugStep
if debug
else [XSY.DebugStep.MAKE_ARRAY_DEFS, XSY.DebugStep.COMPLETE]
):
xsy.expand_datablock(debug_step=debug_step).to_csv(
self.out_path.joinpath(