Set up tests for XSY parser.

This commit is contained in:
Josh Lucas
2026-04-17 16:17:43 -05:00
parent 6dbf963691
commit 5e77d03d74
10 changed files with 26 additions and 8 deletions

7
.vscode/settings.json vendored Normal file
View File

@@ -0,0 +1,7 @@
{
"python.testing.pytestArgs": [
"tests"
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true
}

View File

@@ -1,5 +1,5 @@
[build-system]
requires = ["uv_build >= 0.11.6"]
requires = ["uv_build>=0.11.7,<0.12"]
build-backend = "uv_build"
[project]

View File

@@ -1,6 +1,7 @@
import os
import sys
from collections.abc import Sequence
from importlib import resources
import pandas as pd
from pandas import DataFrame
@@ -35,13 +36,17 @@ class XSY():
xsy_path: os.path,
dir_path: os.path = '',
def_paths: Sequence[os.path] = [],
db_ss_path: os.path = 'flatten_datablock.xslt',
ddt_ss_path: os.path = 'flatten_ddtsource.xslt',
db_ss_path: os.path = 'data/flatten_datablock.xslt',
ddt_ss_path: os.path = 'data/flatten_ddtsource.xslt',
) -> None:
self.dir_path: os.path = dir_path
self.xsy_path: os.path = os.path.join(dir_path, xsy_path)
self.db_ss_path: os.path = os.path.join(dir_path, db_ss_path)
self.ddt_ss_path: os.path = os.path.join(dir_path, ddt_ss_path)
self.db_ss_path: os.path = resources.files(
"AuDaGe.formats.controlexpert.xsy"
).joinpath(db_ss_path)
self.ddt_ss_path: os.path = resources.files(
"AuDaGe.formats.controlexpert.xsy"
).joinpath(ddt_ss_path)
self.def_paths: list[os.path] = [
os.path.join(dir_path, def_path) for def_path in def_paths
]

9
tests/test_xsy.py Normal file
View File

@@ -0,0 +1,9 @@
from pandas import DataFrame
from AuDaGe.formats.controlexpert.xsy import XSY
def test_init():
assert isinstance(XSY("tests/data/hsps.xsy"), XSY)
def test_read_datablock():
xsy = XSY("tests/data/hsps.xsy")
assert isinstance(xsy.read_datablock(), DataFrame)

View File

@@ -1,3 +0,0 @@
from AuDaGe.formats.controlexpert.xsy import XSY
print(XSY("hsps.xsy"))