Fix tests (#663)

This commit is contained in:
cybermaggedon 2026-03-06 12:40:02 +00:00 committed by GitHub
parent 2b9232917c
commit be358efe67
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 27 additions and 13 deletions

View file

@ -569,14 +569,24 @@ class TestServiceHelperFunctions:
assert term.language == 'en'
def test_create_term_with_triple_otype(self):
"""Test create_term creates IRI Term for otype='t'"""
"""Test create_term creates TRIPLE Term for otype='t' with valid JSON"""
from trustgraph.query.triples.cassandra.service import create_term
from trustgraph.schema import IRI
from trustgraph.schema import TRIPLE, IRI
import json
term = create_term('http://example.org/statement1', otype='t')
# Valid JSON triple data
triple_json = json.dumps({
"s": {"type": "i", "iri": "http://example.org/Alice"},
"p": {"type": "i", "iri": "http://example.org/knows"},
"o": {"type": "i", "iri": "http://example.org/Bob"},
})
assert term.type == IRI
assert term.iri == 'http://example.org/statement1'
term = create_term(triple_json, otype='t')
assert term.type == TRIPLE
assert term.triple is not None
assert term.triple.s.type == IRI
assert term.triple.s.iri == "http://example.org/Alice"
def test_create_term_heuristic_fallback_uri(self):
"""Test create_term uses URL heuristic when otype not provided"""