From ac2acb10f4f8c919ccd3a3615ee62c740ba2116e Mon Sep 17 00:00:00 2001 From: Christian Ledermann Date: Thu, 4 Jan 2024 16:38:48 +0000 Subject: [PATCH] fix typos, ignore import errors in coverage --- fastkml/styles.py | 5 ++++- pyproject.toml | 1 + tests/registry_test.py | 4 ++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/fastkml/styles.py b/fastkml/styles.py index 1ce147da..1271a5bf 100644 --- a/fastkml/styles.py +++ b/fastkml/styles.py @@ -378,7 +378,7 @@ def __repr__(self) -> str: ")" ) - def ___bool__(self) -> bool: + def __bool__(self) -> bool: return bool(self.icon) @@ -811,6 +811,9 @@ def __repr__(self) -> str: ")" ) + def __bool__(self) -> bool: + return bool(self.styles) + def append_style( self, style: AnyStyle, diff --git a/pyproject.toml b/pyproject.toml index 76ed3e8f..dfba1cd1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -118,6 +118,7 @@ source = [ [tool.coverage.report] exclude_also = [ "^\\s*\\.\\.\\.$", + "except ImportError:", "if TYPE_CHECKING:", ] diff --git a/tests/registry_test.py b/tests/registry_test.py index 178d501d..a0cddbe7 100644 --- a/tests/registry_test.py +++ b/tests/registry_test.py @@ -70,7 +70,7 @@ def set_element( """Get an attribute from an XML object.""" -def get_kwarg( +def get_kwarg( # type: ignore[empty-body] *, element: Element, ns: str, @@ -81,7 +81,7 @@ def get_kwarg( strict: bool, ) -> Dict[str, Any]: """Get the kwarg for the constructor from the element.""" - return {kwarg: None} + ... def test_registry_get_root() -> None: