Format with Ruff.

This commit is contained in:
Silcantar
2026-09-14 15:39:21 -05:00
parent 50a81c3a5c
commit bcdd674c4e
9 changed files with 134 additions and 206 deletions

View File

@@ -2,22 +2,28 @@ import unittest
from AuDaGe.audage_frame 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"]
})
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"]
})
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)
unittest.main(failfast=True)

View File

@@ -8,4 +8,4 @@ date: 2026-09-14
desc: Unit tests for the AuDaGe format module.
"""
import unittest
import unittest

View File

@@ -12,6 +12,7 @@ import unittest
from AuDaGe import iec
class TestIEC(unittest.TestCase):
""""""
@@ -19,9 +20,9 @@ class TestIEC(unittest.TestCase):
iec_definitions = iec.iec_definitions()
self.assertTrue(iec_definitions.is_valid())
self.assertEqual(
iec_definitions.dataframe.shape,
(len(iec.DataTypes.__members__), 7)
)
iec_definitions.dataframe.shape, (len(iec.DataTypes.__members__), 7)
)
if __name__ == "__main__":
unittest.main(failfast=True)
unittest.main(failfast=True)

View File

@@ -10,17 +10,15 @@ desc: Unit tests for the AuDaGe XSY module.
import os
import unittest
from timeit import default_timer as timer
# from pandas import DataFrame
# from timeit import default_timer as timer
from AuDaGe.formats.controlexpert.xsy import XSY
IN_PATH = "tests/assets"
OUT_PATH = "tests/output"
class TestXSY(unittest.TestCase):
class TestXSY(unittest.TestCase):
def test_init(self):
assert isinstance(XSY(os.path.join(IN_PATH, "hsps.xsy")), XSY)
@@ -28,12 +26,10 @@ class TestXSY(unittest.TestCase):
xsy = XSY()
xsy.read(os.path.join(IN_PATH, "hsps.xsy"), expand=False)
xsy.datablock.dataframe.to_csv(
os.path.join(OUT_PATH, "datablock.csv"),
index=False
os.path.join(OUT_PATH, "datablock.csv"), index=False
)
xsy.definitions.dataframe.to_csv(
os.path.join(OUT_PATH, "defs.csv"),
index=False
os.path.join(OUT_PATH, "defs.csv"), index=False
)
# xsy.expand_datablock(datablock).to_csv(
# os.path.join(OUT_PATH, "expanded.csv"),
@@ -42,4 +38,4 @@ class TestXSY(unittest.TestCase):
if __name__ == "__main__":
unittest.main(failfast=True)
unittest.main(failfast=True)