feat: Enhance placeholder resolution and error handling
- Updated `extract_value_raw` to improve JSON parsing and handle unavailable data more effectively. - Introduced new functions in `placeholder_resolver.py` for standardized responses when data is unavailable, enhancing clarity for users and AI. - Modified various data retrieval functions to utilize the new response format, providing detailed reasons for unavailability. - Improved availability checks in `export_placeholder_values_extended` to account for new response formats. These changes enhance the robustness of the placeholder system and improve user experience by providing clearer error messages and data handling.
This commit is contained in:
1 parent
052ba195cc
commit
04e23d8115
4 files changed
+320
-34
No files matched your search
@@ -44,6 +44,15 @@ def test_value_raw_json():
|
||||
assert not success
|
||||
assert val is None
|
||||
|
||||
# Resolver-Fehlerhülle (kein verwertbares JSON für Charts)
|
||||
val, success = extract_value_raw(
|
||||
'{"_available": false, "_reason": "test"}',
|
||||
OutputType.JSON,
|
||||
PlaceholderType.RAW_DATA,
|
||||
)
|
||||
assert not success
|
||||
assert val is None
|
||||
|
||||
|
||||
def test_value_raw_number():
|
||||
"""Numeric outputs must extract numbers without units."""
|
||||
@@ -66,6 +75,13 @@ def test_value_raw_number():
|
||||
val, success = extract_value_raw('nicht verfügbar', OutputType.NUMBER, PlaceholderType.ATOMIC)
|
||||
assert not success
|
||||
|
||||
val, success = extract_value_raw(
|
||||
'nicht verfügbar — Keine Messungen (detail)',
|
||||
OutputType.NUMBER,
|
||||
PlaceholderType.ATOMIC,
|
||||
)
|
||||
assert not success
|
||||
|
||||
|
||||
def test_value_raw_markdown():
|
||||
"""Markdown outputs keep as string."""
|
||||
|
||||
Reference in new issue
Block a user