diff options
author | tgingold <tgingold@users.noreply.github.com> | 2022-12-24 08:56:55 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-24 08:56:55 +0100 |
commit | 26bb3c572eaffafafd8de8ef09b8acc34f91656f (patch) | |
tree | 2d70696f4f8bb78f9a4fda7a6d596775fdf080cc /testsuite/pyunit/dom/Literals.py | |
parent | 8845f761ed2299e595afd5eee2444fed7fb79639 (diff) | |
parent | 5d9897770cb16494c6379cce85ed5935532c0cd1 (diff) | |
download | ghdl-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/Literals.py')
-rw-r--r-- | testsuite/pyunit/dom/Literals.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/testsuite/pyunit/dom/Literals.py b/testsuite/pyunit/dom/Literals.py index debd401e3..9f53a6cc6 100644 --- a/testsuite/pyunit/dom/Literals.py +++ b/testsuite/pyunit/dom/Literals.py @@ -32,6 +32,7 @@ # ============================================================================ from pathlib import Path from textwrap import dedent +from typing import TypeVar, Dict from unittest import TestCase from pyVHDLModel.SyntaxModel import ExpressionUnion @@ -49,6 +50,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 Literals(TestCase): _root = Path(__file__).resolve().parent.parent _design = Design() @@ -67,7 +75,7 @@ class Literals(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: ExpressionUnion = item.DefaultExpression |