aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/pyunit/dom/Expressions.py
diff options
context:
space:
mode:
authortgingold <tgingold@users.noreply.github.com>2022-12-24 08:56:55 +0100
committerGitHub <noreply@github.com>2022-12-24 08:56:55 +0100
commit26bb3c572eaffafafd8de8ef09b8acc34f91656f (patch)
tree2d70696f4f8bb78f9a4fda7a6d596775fdf080cc /testsuite/pyunit/dom/Expressions.py
parent8845f761ed2299e595afd5eee2444fed7fb79639 (diff)
parent5d9897770cb16494c6379cce85ed5935532c0cd1 (diff)
downloadghdl-26bb3c572eaffafafd8de8ef09b8acc34f91656f.tar.gz
ghdl-26bb3c572eaffafafd8de8ef09b8acc34f91656f.tar.bz2
ghdl-26bb3c572eaffafafd8de8ef09b8acc34f91656f.zip
Merge pull request #2265 from Paebbels/paebbels/DOM-with-documentation
pyGHDL.dom with Documentation
Diffstat (limited to 'testsuite/pyunit/dom/Expressions.py')
-rw-r--r--testsuite/pyunit/dom/Expressions.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/testsuite/pyunit/dom/Expressions.py b/testsuite/pyunit/dom/Expressions.py
index 113e541ac..4b2e47507 100644
--- a/testsuite/pyunit/dom/Expressions.py
+++ b/testsuite/pyunit/dom/Expressions.py
@@ -34,6 +34,7 @@ import ctypes
from inspect import currentframe
from pathlib import Path
from textwrap import dedent
+from typing import TypeVar, Dict
from unittest import TestCase
@@ -51,6 +52,13 @@ if __name__ == "__main__":
exit(1)
+_DictKey = TypeVar("_DictKey")
+_DictValue = TypeVar("_DictValue")
+
+def firstValue(d: Dict[_DictKey, _DictValue]) -> _DictValue:
+ return next(iter(d.values()))
+
+
class Expressions(TestCase):
_root = Path(__file__).resolve().parent.parent
_design = Design()
@@ -69,7 +77,7 @@ class Expressions(TestCase):
self._design.Documents.append(document)
# Traverse already to default value expression
- package: Package = document.Packages[0]
+ package: Package = firstValue(document.Packages)
item: Constant = package.DeclaredItems[0]
default: Expression = item.DefaultExpression