mirror of
https://github.com/semantica-agi/semantica.git
synced 2026-08-29 04:26:20 +00:00
- rdf_exporter.py: add isinstance(format, str) guard before .lower() so non-string inputs (None, int, etc.) raise ValidationError consistently instead of AttributeError; normalize via strip().lower() in one step - 15_Export.ipynb: fix notebook cell using result['valid'] → result['overall_valid'] (validate_rdf() returns overall_valid, not valid); add trailing EOF newline - test_rdf_exporter.py: add tests for non-string format → ValidationError and for overall_valid key presence in validate_rdf() return value Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
eb21b851df
commit
1d96b6f80e
@@ -71,3 +71,21 @@ def test_ttl_export_to_file(exporter, tmp_path):
|
||||
exporter.export(RDF_DATA, str(out), format="ttl")
|
||||
assert out.exists()
|
||||
assert out.stat().st_size > 0
|
||||
|
||||
|
||||
def test_non_string_format_raises_validation_error(exporter):
|
||||
"""format=None or non-string must raise ValidationError, not AttributeError."""
|
||||
from semantica.utils.exceptions import ValidationError
|
||||
|
||||
with pytest.raises(ValidationError):
|
||||
exporter.export_to_rdf(RDF_DATA, format=None)
|
||||
|
||||
with pytest.raises(ValidationError):
|
||||
exporter.export_to_rdf(RDF_DATA, format=123)
|
||||
|
||||
|
||||
def test_validate_rdf_returns_overall_valid_key(exporter):
|
||||
"""validate_rdf() must return 'overall_valid' key (used in notebook example)."""
|
||||
result = exporter.validate_rdf(RDF_DATA)
|
||||
assert "overall_valid" in result
|
||||
assert isinstance(result["overall_valid"], bool)
|
||||
|
||||
Reference in New Issue
Block a user