diff options
Diffstat (limited to 'testsuite/pyunit/dom/Expressions.py')
-rw-r--r-- | testsuite/pyunit/dom/Expressions.py | 10 |
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 |