diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_audage.py b/tests/test_audage.py new file mode 100644 index 0000000..35ea5ea --- /dev/null +++ b/tests/test_audage.py @@ -0,0 +1,23 @@ +import unittest + +from AuDaGe.audage import AuDaGeFrame + +class TestAuDaGeFrame(unittest.TestCase): + def test_init(self): + valid_adf = AuDaGeFrame({ + "name": ["a", "b", "c"], + "type": ["d", "e", "f"], + "address": [1, 2, 3], + "comment": ["g", "h", "i"] + }) + self.assertTrue(valid_adf.is_valid()) + invalid_adf = AuDaGeFrame({ + "name": ["a", "b", "c"], + # "type": ["d", "e", "f"], + "address": [1, 2, 3], + "comment": ["g", "h", "i"] + }) + self.assertFalse(invalid_adf.is_valid()) + +if __name__ == "__main__": + unittest.main(failfast=True) \ No newline at end of file diff --git a/tests/test_format.py b/tests/test_format.py new file mode 100644 index 0000000..5618f5c --- /dev/null +++ b/tests/test_format.py @@ -0,0 +1,11 @@ +""" +AuDaGe format tests + +name: test_format.py +by: Josh Lucas +date: 2026-09-14 + +desc: Unit tests for the AuDaGe format module. +""" + +import unittest \ No newline at end of file diff --git a/tests/test_iec.py b/tests/test_iec.py new file mode 100644 index 0000000..da217d2 --- /dev/null +++ b/tests/test_iec.py @@ -0,0 +1,27 @@ +""" +AuDaGe IEC tests + +name: test_iec.py +by: Josh Lucas +date: 2026-09-14 + +desc: Unit tests for the AuDaGe IEC module. +""" + +import unittest + +from AuDaGe import iec + +class TestIEC(unittest.TestCase): + """""" + + def test_iec_definitions(self): + iec_definitions = iec.iec_definitions() + self.assertTrue(iec_definitions.is_valid()) + self.assertEqual( + iec_definitions.shape, + (len(iec.DataTypes.__members__), 7) + ) + +if __name__ == "__main__": + unittest.main(failfast=True) \ No newline at end of file diff --git a/tests/test_xsy.py b/tests/test_xsy.py index 5c5b421..a3b5fb3 100644 --- a/tests/test_xsy.py +++ b/tests/test_xsy.py @@ -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) \ No newline at end of file