diff options
author | Patrick Lehmann <Patrick.Lehmann@plc2.de> | 2022-12-23 23:01:12 +0100 |
---|---|---|
committer | Patrick Lehmann <Patrick.Lehmann@plc2.de> | 2022-12-23 23:44:14 +0100 |
commit | fbb81d6e6c30d6281e9f3b8a74c3cda41928f81c (patch) | |
tree | a99ecbcd62bcf9505a11c2dfb5f8c4c0e68ad878 /testsuite/pyunit/dom/Simple.py | |
parent | 5e5e2fb50ed6eba32d614c9c566e280a6f992acb (diff) | |
download | ghdl-fbb81d6e6c30d6281e9f3b8a74c3cda41928f81c.tar.gz ghdl-fbb81d6e6c30d6281e9f3b8a74c3cda41928f81c.tar.bz2 ghdl-fbb81d6e6c30d6281e9f3b8a74c3cda41928f81c.zip |
Updated to pyVHDLModel v0.18.0.
Diffstat (limited to 'testsuite/pyunit/dom/Simple.py')
-rw-r--r-- | testsuite/pyunit/dom/Simple.py | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/testsuite/pyunit/dom/Simple.py b/testsuite/pyunit/dom/Simple.py index 32033609d..82dd8579e 100644 --- a/testsuite/pyunit/dom/Simple.py +++ b/testsuite/pyunit/dom/Simple.py @@ -31,6 +31,7 @@ # SPDX-License-Identifier: GPL-2.0-or-later # ============================================================================ from pathlib import Path +from typing import TypeVar, Dict from unittest import TestCase from pyGHDL.dom.NonStandard import Design, Document @@ -42,6 +43,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 SimpleEntity(TestCase): _root = Path(__file__).resolve().parent.parent _filename: Path = _root / "dom/examples/SimpleEntity.vhdl" @@ -71,7 +79,7 @@ class SimpleEntity(TestCase): self.assertEqual(1, len(design.Documents[0].Entities)) - entity = design.Documents[0].Entities[0] + entity = firstValue(design.Documents[0].Entities) self.assertEqual("Counter", entity.Identifier) print() print(entity.Documentation) @@ -84,7 +92,7 @@ class SimpleEntity(TestCase): self.assertEqual(1, len(design.Documents[0].Architectures)) - architecture = design.Documents[0].Architectures[0] + architecture = firstValue(firstValue(design.Documents[0].Architectures)) self.assertEqual("rtl", architecture.Identifier) print() print(architecture.Documentation) @@ -120,7 +128,7 @@ class SimplePackage(TestCase): self.assertEqual(1, len(design.Documents[0].Packages)) - package = design.Documents[0].Packages[0] + package = firstValue(design.Documents[0].Packages) self.assertEqual("utilities", package.Identifier) print() print(package.Documentation) @@ -133,7 +141,7 @@ class SimplePackage(TestCase): self.assertEqual(1, len(design.Documents[0].PackageBodies)) - packageBodies = design.Documents[0].PackageBodies[0] + packageBodies = firstValue(design.Documents[0].PackageBodies) self.assertEqual("utilities", packageBodies.Identifier) print() print(packageBodies.Documentation) |