Skip to content

Commit 2012d64

Browse files
authored
#313 Add SzAbstractFactory.Destroy() (#314)
* #313 Add SzAbstractFactory.Destroy() * #313 Add SzAbstractFactory.Destroy()
1 parent 58c63f2 commit 2012d64

File tree

7 files changed

+41
-1
lines changed

7 files changed

+41
-1
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning].
77

88
## [Unreleased]
99

10+
## [0.2.19] - 2025-07-16
11+
12+
### Added in 0.2.19
13+
14+
- Added `SzAbstractFactory.Destroy()`
15+
1016
## [0.2.18] - 2025-07-14
1117

1218
### Added in 0.2.18
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from senzing import SzError
2+
3+
from . import sz_abstract_factory
4+
5+
try:
6+
sz_abstract_factory.destroy()
7+
except SzError as err:
8+
print(f"\nERROR: {err}\n")
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
// No output from this example.

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = senzing
3-
version = 0.2.18
3+
version = 0.2.19
44
author = senzing
55
author_email = support@senzing.com
66
description = Python SDK method definitions

src/senzing/szabstractfactory.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,23 @@ def create_product(self) -> SzProduct:
136136
:language: json
137137
"""
138138

139+
@abstractmethod
140+
def destroy(self) -> None:
141+
"""
142+
The `destroy` method destroys the AbstractFactory and all objects created by the
143+
AbstractFactory.
144+
145+
Raises:
146+
TypeError: Incorrect datatype of input parameter.
147+
szexception.SzError: config_id does not exist.
148+
149+
.. collapse:: Example:
150+
151+
.. literalinclude:: ../../examples/szabstractfactory/destroy.py
152+
:linenos:
153+
:language: python
154+
"""
155+
139156
@abstractmethod
140157
def reinitialize(self, config_id: int) -> None:
141158
"""

src/senzing_mock/senzing_mock.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,9 @@ def create_product(self, **kwargs: Any) -> SzProduct:
389389
_ = kwargs
390390
return SzProductMock()
391391

392+
def destroy(self, **kwargs: Any) -> None:
393+
_ = kwargs
394+
392395
def reinitialize(self, config_id: int, **kwargs: Any) -> None:
393396
_ = kwargs
394397

tests/szabstractfactory_test.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ def test_reinitialize(sz_abstractfactory: SzAbstractFactory) -> None:
5959
sz_abstractfactory.reinitialize(0)
6060

6161

62+
def test_destroy(sz_abstractfactory: SzAbstractFactory) -> None:
63+
"""Test SzAbstractFactory.test_destroy()."""
64+
sz_abstractfactory.destroy()
65+
66+
6267
# -----------------------------------------------------------------------------
6368
# Fixtures
6469
# -----------------------------------------------------------------------------

0 commit comments

Comments
 (0)