From 6cb5d25f5c74de5b7794dc84ce91ebb5cb0d08a0 Mon Sep 17 00:00:00 2001 From: Jakob Scheid Date: Tue, 7 Apr 2026 22:57:18 +0200 Subject: [PATCH] Add checking whether sub namespaces are not empty in core.python.namespaces.PythonPackageNamespace.namespace --- docs/CHANGELOG.md | 3 ++- src/jcloud_docsgen/core/python/namespaces.py | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 5a8c7dd..8392eaa 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -9,4 +9,5 @@ - Add function to assert that an object is an instance of a specific type - Add python project documentation generator class - Add python namespaces classes -- Add type checking for the `name` attribute at the constructor of `core.python.namespaces.PythonNamespace` \ No newline at end of file +- Add type checking for the `name` attribute at the constructor of `core.python.namespaces.PythonNamespace` +- Add check whether sub namespaces are not empty in `core.python.namespaces.PythonPackageNamespace.namespace` \ No newline at end of file diff --git a/src/jcloud_docsgen/core/python/namespaces.py b/src/jcloud_docsgen/core/python/namespaces.py index 120f51c..5e8c5b5 100644 --- a/src/jcloud_docsgen/core/python/namespaces.py +++ b/src/jcloud_docsgen/core/python/namespaces.py @@ -57,6 +57,10 @@ class PythonPackageNamespace(PythonNamespace): if not sub_namespaces: raise InvalidNamespaceError('invalid namespace') + for sn in sub_namespaces: + if not sn: + raise InvalidNamespaceError('invalid namespace') + # check whether the sub namespace exists if sub_namespaces[0] not in self.sub_namespaces: raise NamespaceNotFoundError('no such namespace', namespace_identifier = sub_namespaces[0])