diff --git a/CHANGELOG.md b/CHANGELOG.md index a4696da..05f21ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.14.8] - 2024-05-14 + +### Changed +- AudioEventsConfig class now defaults to empty dict instead of empty list when types not provided + ## [1.14.7] - 2024-04-08 ## Fixed diff --git a/VERSION b/VERSION index 52e779f..9be7846 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.14.7 +1.14.8 diff --git a/speechmatics/models.py b/speechmatics/models.py index fae5751..270fac6 100644 --- a/speechmatics/models.py +++ b/speechmatics/models.py @@ -220,12 +220,12 @@ class AutoChaptersConfig: @dataclass class AudioEventsConfig: - types: Optional[List[str]] + types: Optional[List[str]] = None """Optional list of audio event types to detect.""" def asdict(self): if self.types is None: - self.types = [] + return {} return asdict(self) diff --git a/tests/test_models.py b/tests/test_models.py index 5821763..62703cb 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -200,3 +200,23 @@ def test_topic_detection_config(params, want): def test_notification_config(params, want): notification_config = models.NotificationConfig(**params) assert asdict(notification_config) == want + + +@mark.parametrize( + "params, want", + [ + param( + {"types": None}, + {}, + id="default params", + ), + param( + {"types": ["music"]}, + {"types": ["music"]}, + id="set types param", + ), + ], +) +def test_audio_events_config_config(params, want): + audio_events_config = models.AudioEventsConfig(**params) + assert audio_events_config.asdict() == want