aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/pyunit/dom
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/pyunit/dom')
-rw-r--r--testsuite/pyunit/dom/Expressions.py14
-rw-r--r--testsuite/pyunit/dom/Literals.py14
-rw-r--r--testsuite/pyunit/dom/Sanity.py9
-rw-r--r--testsuite/pyunit/dom/SimpleEntity.py58
-rw-r--r--testsuite/pyunit/dom/SimplePackage.py38
5 files changed, 69 insertions, 64 deletions
diff --git a/testsuite/pyunit/dom/Expressions.py b/testsuite/pyunit/dom/Expressions.py
index bc45b3cdf..f9c066f52 100644
--- a/testsuite/pyunit/dom/Expressions.py
+++ b/testsuite/pyunit/dom/Expressions.py
@@ -30,14 +30,14 @@
#
# SPDX-License-Identifier: GPL-2.0-or-later
# ============================================================================
-from pathlib import Path
+from pathlib import Path
from textwrap import dedent
from unittest import TestCase
from pyGHDL.dom.DesignUnit import Package
from pyGHDL.dom import Expression
-from pyGHDL.dom.NonStandard import Design, Document
+from pyGHDL.dom.NonStandard import Design, Document
from pyGHDL.dom.Symbol import SimpleObjectOrFunctionCallSymbol
from pyGHDL.dom.Object import Constant
from pyGHDL.dom.Expression import InverseExpression
@@ -52,13 +52,17 @@ class Expressions(TestCase):
_root = Path(__file__).resolve().parent.parent
def test_NotExpression(self):
- self._filename: Path = self._root / "{className}.vhdl".format(className=self.__class__.__name__)
+ self._filename: Path = self._root / "{className}.vhdl".format(
+ className=self.__class__.__name__
+ )
- sourceCode = dedent("""\
+ sourceCode = dedent(
+ """\
package package_1 is
constant c0 : boolean := not true;
end package;
- """)
+ """
+ )
with self._filename.open(mode="w", encoding="utf-8") as file:
file.write(sourceCode)
diff --git a/testsuite/pyunit/dom/Literals.py b/testsuite/pyunit/dom/Literals.py
index 9ab709195..ebd702f5e 100644
--- a/testsuite/pyunit/dom/Literals.py
+++ b/testsuite/pyunit/dom/Literals.py
@@ -30,11 +30,11 @@
#
# SPDX-License-Identifier: GPL-2.0-or-later
# ============================================================================
-from pathlib import Path
+from pathlib import Path
from textwrap import dedent
from unittest import TestCase
-from pyGHDL.dom.NonStandard import Design, Document
+from pyGHDL.dom.NonStandard import Design, Document
from pyGHDL.dom.Object import Constant
from pyGHDL.dom.Literal import IntegerLiteral
@@ -49,16 +49,20 @@ class Literals(TestCase):
_root = Path(__file__).resolve().parent.parent
def test_IntegerLiteral(self):
- self._filename: Path = self._root / "{className}.vhdl".format(className=self.__class__.__name__)
+ self._filename: Path = self._root / "{className}.vhdl".format(
+ className=self.__class__.__name__
+ )
- sourceCode = dedent("""\
+ sourceCode = dedent(
+ """\
package package_1 is
constant c0 : integer := 0;
constant c1 : integer := 1;
constant c2 : integer := 1024;
constant c3 : integer := 1048576;
end package;
- """)
+ """
+ )
expected = (0, 1, 1024, 1048576)
with self._filename.open(mode="w", encoding="utf-8") as file:
diff --git a/testsuite/pyunit/dom/Sanity.py b/testsuite/pyunit/dom/Sanity.py
index 20beb8cbe..10258c38c 100644
--- a/testsuite/pyunit/dom/Sanity.py
+++ b/testsuite/pyunit/dom/Sanity.py
@@ -32,7 +32,7 @@
# ============================================================================
from sys import executable
from subprocess import check_call, STDOUT
-from pathlib import Path
+from pathlib import Path
from pytest import mark
if __name__ == "__main__":
@@ -43,11 +43,8 @@ if __name__ == "__main__":
_TESTSUITE_ROOT = Path(__file__).parent.parent.parent.resolve()
_GHDL_ROOT = _TESTSUITE_ROOT.parent
+
@mark.xfail
@mark.parametrize("file", [str(f) for f in _TESTSUITE_ROOT.glob("sanity/**/*.vhdl")])
def test_AllVHDLSources(file):
- check_call([
- executable,
- _GHDL_ROOT / "pyGHDL/cli/DOM.py",
- file
- ], stderr=STDOUT)
+ check_call([executable, _GHDL_ROOT / "pyGHDL/cli/DOM.py", file], stderr=STDOUT)
diff --git a/testsuite/pyunit/dom/SimpleEntity.py b/testsuite/pyunit/dom/SimpleEntity.py
index b6db82381..9ee55508c 100644
--- a/testsuite/pyunit/dom/SimpleEntity.py
+++ b/testsuite/pyunit/dom/SimpleEntity.py
@@ -30,49 +30,49 @@
#
# SPDX-License-Identifier: GPL-2.0-or-later
# ============================================================================
-from pathlib import Path
+from pathlib import Path
from unittest import TestCase
-from pyGHDL.dom.NonStandard import Design, Document
+from pyGHDL.dom.NonStandard import Design, Document
if __name__ == "__main__":
- print("ERROR: you called a testcase declaration file as an executable module.")
- print("Use: 'python -m unitest <testcase module>'")
- exit(1)
+ print("ERROR: you called a testcase declaration file as an executable module.")
+ print("Use: 'python -m unitest <testcase module>'")
+ exit(1)
class SimpleEntity(TestCase):
- _root = Path(__file__).resolve().parent.parent
- _filename : Path = _root / "SimpleEntity.vhdl"
+ _root = Path(__file__).resolve().parent.parent
+ _filename: Path = _root / "SimpleEntity.vhdl"
- def test_Design(self):
- design = Design()
+ def test_Design(self):
+ design = Design()
- self.assertIsNotNone(design)
+ self.assertIsNotNone(design)
- # def test_Library(self):
- # library = Library()
+ # def test_Library(self):
+ # library = Library()
- def test_Document(self):
- design = Design()
- document = Document(self._filename)
- design.Documents.append(document)
+ def test_Document(self):
+ design = Design()
+ document = Document(self._filename)
+ design.Documents.append(document)
- self.assertTrue(len(design.Documents) == 1)
+ self.assertTrue(len(design.Documents) == 1)
- def test_Entity(self):
- design = Design()
- document = Document(self._filename)
- design.Documents.append(document)
+ def test_Entity(self):
+ design = Design()
+ document = Document(self._filename)
+ design.Documents.append(document)
- self.assertEqual(len(design.Documents[0].Entities), 1)
- self.assertTrue(design.Documents[0].Entities[0].Name == "entity_1")
+ self.assertEqual(len(design.Documents[0].Entities), 1)
+ self.assertTrue(design.Documents[0].Entities[0].Name == "entity_1")
- def test_Architecture(self):
- design = Design()
- document = Document(self._filename)
- design.Documents.append(document)
+ def test_Architecture(self):
+ design = Design()
+ document = Document(self._filename)
+ design.Documents.append(document)
- self.assertEqual(len(design.Documents[0].Architectures), 1)
- self.assertTrue(design.Documents[0].Architectures[0].Name == "behav")
+ self.assertEqual(len(design.Documents[0].Architectures), 1)
+ self.assertTrue(design.Documents[0].Architectures[0].Name == "behav")
diff --git a/testsuite/pyunit/dom/SimplePackage.py b/testsuite/pyunit/dom/SimplePackage.py
index e519d2fb6..399a676b4 100644
--- a/testsuite/pyunit/dom/SimplePackage.py
+++ b/testsuite/pyunit/dom/SimplePackage.py
@@ -30,34 +30,34 @@
#
# SPDX-License-Identifier: GPL-2.0-or-later
# ============================================================================
-from pathlib import Path
+from pathlib import Path
from unittest import TestCase
-from pyGHDL.dom.NonStandard import Design, Document
+from pyGHDL.dom.NonStandard import Design, Document
if __name__ == "__main__":
- print("ERROR: you called a testcase declaration file as an executable module.")
- print("Use: 'python -m unitest <testcase module>'")
- exit(1)
+ print("ERROR: you called a testcase declaration file as an executable module.")
+ print("Use: 'python -m unitest <testcase module>'")
+ exit(1)
class SimplePackage(TestCase):
- _root = Path(__file__).resolve().parent.parent
- _filename : Path = _root / "SimplePackage.vhdl"
+ _root = Path(__file__).resolve().parent.parent
+ _filename: Path = _root / "SimplePackage.vhdl"
- def test_Package(self):
- design = Design()
- document = Document(self._filename)
- design.Documents.append(document)
+ def test_Package(self):
+ design = Design()
+ document = Document(self._filename)
+ design.Documents.append(document)
- self.assertEqual(len(design.Documents[0].Packages), 1)
- self.assertTrue(design.Documents[0].Packages[0].Name == "pack_1")
+ self.assertEqual(len(design.Documents[0].Packages), 1)
+ self.assertTrue(design.Documents[0].Packages[0].Name == "pack_1")
- def test_PackageBody(self):
- design = Design()
- document = Document(self._filename)
- design.Documents.append(document)
+ def test_PackageBody(self):
+ design = Design()
+ document = Document(self._filename)
+ design.Documents.append(document)
- self.assertEqual(len(design.Documents[0].PackageBodies), 1)
- self.assertTrue(design.Documents[0].PackageBodies[0].Name == "pack_1")
+ self.assertEqual(len(design.Documents[0].PackageBodies), 1)
+ self.assertTrue(design.Documents[0].PackageBodies[0].Name == "pack_1")