From b0a0d3e45b6d6136de5ed5ac510c337a009412a1 Mon Sep 17 00:00:00 2001 From: Jakob Scheid Date: Tue, 7 Apr 2026 14:22:09 +0200 Subject: [PATCH] Add type checking for the name attribute at the constructor of core.python.namespaces.PythonNamespace --- docs/CHANGELOG.md | 3 ++- src/jcloud_docsgen/core/python/namespaces.py | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 0680655..5a8c7dd 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -8,4 +8,5 @@ - Add function to format a list human-readable - Add function to assert that an object is an instance of a specific type - Add python project documentation generator class -- Add python namespaces classes \ No newline at end of file +- 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 diff --git a/src/jcloud_docsgen/core/python/namespaces.py b/src/jcloud_docsgen/core/python/namespaces.py index a8524fb..250c926 100644 --- a/src/jcloud_docsgen/core/python/namespaces.py +++ b/src/jcloud_docsgen/core/python/namespaces.py @@ -13,6 +13,7 @@ # limitations under the License. from ...exceptions import InvalidNamespaceError, NamespaceNotFoundError +from ...utils import assert_that_is_instance __all__ = [ 'PythonNamespace', @@ -28,6 +29,8 @@ class PythonNamespace: :type name: str ''' def __init__(self, name: str) -> None: + assert_that_is_instance(name, str) + self.name = name class PythonPackageNamespace(PythonNamespace):