diff --git a/.github/workflows/Release.yml b/.github/workflows/Release.yml index 3646e7c06..d77c3f8c5 100644 --- a/.github/workflows/Release.yml +++ b/.github/workflows/Release.yml @@ -34,7 +34,7 @@ jobs: python setup.py bdist_wheel - name: Release Python package to PyPI - if: startsWith(github.ref, 'refs/tags') +# if: startsWith(github.ref, 'refs/tags') env: TWINE_USERNAME: __token__ TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} diff --git a/pyVHDLModel/VHDLModel.py b/pyVHDLModel/VHDLModel.py index d9d916557..58b32116e 100644 --- a/pyVHDLModel/VHDLModel.py +++ b/pyVHDLModel/VHDLModel.py @@ -104,19 +104,25 @@ def Documents(self) -> List['Document']: @export class Library(ModelEntity): + _name: str #: Library name _contexts: List['Context'] #: List of all contexts defined in a library. _configurations: List['Configuration'] #: List of all configurations defined in a library. _entities: List['Entity'] #: List of all entities defined in a library. _packages: List['Package'] #: List of all packages defined in a library. - def __init__(self): + def __init__(self, name: str): super().__init__() + self._name = name self._contexts = [] self._configurations = [] self._entities = [] self._packages = [] + @property + def Name(self) -> str: + return self._name + @property def Contexts(self) -> List['Context']: return self._contexts diff --git a/tests/unit/Instantiate.py b/tests/unit/Instantiate.py index 538988206..7db2e32c3 100644 --- a/tests/unit/Instantiate.py +++ b/tests/unit/Instantiate.py @@ -20,67 +20,98 @@ def test_Design(self): self.assertTrue(len(design.Libraries) == 0) def test_Library(self): - library = Library() + library = Library("lib_1") self.assertIsNotNone(library) + self.assertTrue(library.Name == "lib_1") + self.assertTrue(len(library.Contexts) == 0) + self.assertTrue(len(library.Entities) == 0) + self.assertTrue(len(library.Packages) == 0) + self.assertTrue(len(library.Configurations) == 0) def test_Document(self): path = Path("tests.vhdl") document = Document(path) self.assertIsNotNone(document) + self.assertTrue(document.Path == path) + self.assertTrue(len(document.Entities) == 0) + self.assertTrue(len(document.Architectures) == 0) + self.assertTrue(len(document.Packages) == 0) + self.assertTrue(len(document.PackageBodies) == 0) + self.assertTrue(len(document.Contexts) == 0) + self.assertTrue(len(document.Configurations) == 0) def test_Entity(self): entity = Entity("entity_1") self.assertIsNotNone(entity) + self.assertTrue(entity.Name == "entity_1") + self.assertTrue(len(entity.GenericItems) == 0) + self.assertTrue(len(entity.PortItems) == 0) + self.assertTrue(len(entity.DeclaredItems) == 0) + self.assertTrue(len(entity.BodyItems) == 0) def test_Architecture(self): architecture = Architecture("arch_1") self.assertIsNotNone(architecture) + self.assertTrue(architecture.Name == "arch_1") + self.assertTrue(len(architecture.DeclaredItems) == 0) + self.assertTrue(len(architecture.BodyItems) == 0) def test_Package(self): package = Package("pack_1") self.assertIsNotNone(package) + self.assertTrue(package.Name == "pack_1") + self.assertTrue(len(package.DeclaredItems) == 0) def test_PackageBody(self): packageBody = PackageBody("pack_1") self.assertIsNotNone(packageBody) + self.assertTrue(packageBody.Name == "pack_1") + self.assertTrue(len(packageBody.DeclaredItems) == 0) def test_Context(self): context = Context("ctx_1") self.assertIsNotNone(context) + self.assertTrue(context.Name == "ctx_1") def test_Configuration(self): configuration = Configuration("conf_1") self.assertIsNotNone(configuration) + self.assertTrue(configuration.Name == "conf_1") def test_SubType(self): subtype = SubType("bit") self.assertIsNotNone(subtype) + self.assertTrue(subtype.Name == "bit") def test_Integer(self): integer = IntegerType("integer") self.assertIsNotNone(integer) + self.assertTrue(integer.Name == "integer") def test_Real(self): real = RealType("real") self.assertIsNotNone(real) + self.assertTrue(real.Name == "real") def test_Array(self): array = ArrayType("bit_vector") self.assertIsNotNone(array) + self.assertTrue(array.Name == "bit_vector") def test_Record(self): record = RecordType("range_record") self.assertIsNotNone(record) + self.assertTrue(record.Name == "range_record")