Files
CleverRDFlib/robot/loading_result_tests.robot
CoreRasurae e828acf175
CI / lint (push) Successful in 1m32s
CI / typecheck (push) Successful in 1m38s
CI / lint (pull_request) Successful in 1m30s
CI / typecheck (pull_request) Successful in 1m30s
CI / behave (3.11) (pull_request) Successful in 1m39s
CI / behave (3.12) (pull_request) Successful in 1m39s
CI / build (pull_request) Successful in 1m29s
CI / behave (3.13) (pull_request) Successful in 1m39s
CI / behave (3.11) (push) Successful in 1m39s
CI / behave (3.12) (push) Successful in 1m41s
CI / behave (3.13) (push) Successful in 1m37s
CI / build (push) Successful in 1m30s
feat: Initial version of CleverRDFLib
ISSUES CLOSED: #1
2025-12-19 22:26:14 +00:00

106 lines
6.0 KiB
Plaintext

*** Settings ***
Documentation Test suite for LoadingResult functionality
Library ${CURDIR}/libraries/CleverRDFLibKeywords.py
Library Collections
*** Test Cases ***
Loading Result Should Contain Merged Graph
[Documentation] Test that loading result contains a merged graph with actual triples
[Tags] basic loading_result
Create Ontology Loader
Load Ontology Should Succeed simple_ontology.ttl
${graph}= Get Merged Graph
Should Not Be Equal ${graph} ${None}
${triple_count}= Evaluate len(list($graph)) modules=builtins
Should Be True ${triple_count} > 0 Graph should contain at least one triple
# Verify graph contains expected ontology declaration
Graph Should Contain Triple
... http://example.org/ontology#SimpleOntology
... http://www.w3.org/1999/02/22-rdf-syntax-ns#type
... http://www.w3.org/2002/07/owl#Ontology
Loading Result Should Track Loaded URIs
[Documentation] Test that loading result correctly tracks loaded URIs with specific values
[Tags] basic loading_result
Create Ontology Loader
Load Ontology Should Succeed simple_ontology.ttl
${result}= Get Result
${loaded_uris}= Evaluate $result.loaded_uris modules=builtins
Should Not Be Empty ${loaded_uris}
${count}= Get Length ${loaded_uris}
Should Be Equal As Integers ${count} 1
# Verify the loaded URI contains the expected file name
${uri_list}= Evaluate list($loaded_uris) modules=builtins
${contains_uri}= Evaluate any('simple_ontology.ttl' in str(uri) for uri in $uri_list) modules=builtins
Should Be True ${contains_uri} Loaded URIs should contain simple_ontology.ttl: ${uri_list}
Loading Result Should Indicate Success
[Documentation] Test that loading result correctly indicates success
[Tags] basic loading_result
Create Ontology Loader
Load Ontology Should Succeed simple_ontology.ttl
Result Should Have No Errors
${result}= Get Result
${is_successful_for_all_ontologies}= Evaluate $result.is_successful_for_all_ontologies modules=builtins
Should Be True ${is_successful_for_all_ontologies}
Loading Result Should Provide Error Information
[Documentation] Test that loading result provides error information when loading fails with specific details
[Tags] error_handling loading_result
Create Ontology Loader
Load Ontology non_existent_file.ttl
Result Should Have Errors
${result}= Get Result
${errors}= Evaluate $result.errors modules=builtins
Should Not Be Empty ${errors}
${error_count}= Evaluate len($errors) modules=builtins
Should Be True ${error_count} > 0 Should have at least one error
# Verify error structure - each error should be a dict with message or a string
${first_error}= Get From List ${errors} 0
${has_message}= Evaluate isinstance($first_error, dict) and 'message' in $first_error modules=builtins
${is_string}= Evaluate isinstance($first_error, str) modules=builtins
Should Be True ${has_message} or ${is_string} Error should be a dict with 'message' key or a string
# Verify error message contains file reference
${error_message}= Evaluate $first_error.get('message', str($first_error)) if isinstance($first_error, dict) else str($first_error) modules=builtins
Should Contain ${error_message} non_existent_file.ttl Error message should mention the file that failed
Loading Result Should Track Warnings
[Documentation] Test that loading result can track warnings from an ontology that produces validation warnings
[Tags] basic loading_result
Create Ontology Loader validate_on_load=${True}
# Use warning_ontology.ttl which has circular class definitions
# This should generate validation warnings (circular_definition)
Load Ontology Should Succeed warning_ontology.ttl
${result}= Get Result
${warnings}= Evaluate $result.warnings modules=builtins
# Warnings should exist and be a list
Should Not Be Equal ${warnings} ${None}
Should Be True isinstance($warnings, list) Warnings should be a list
# Check validation result for warnings (validation warnings may not be added to result.warnings
# unless is_valid is False, but we can check validation_result.warnings directly)
${validation_result}= Evaluate $result.owl_validation_result modules=builtins
Should Not Be Equal ${validation_result} ${None}
${validation_warnings}= Evaluate $validation_result.warnings modules=builtins
Should Not Be Equal ${validation_warnings} ${None}
Should Be True isinstance($validation_warnings, list) Validation warnings should be a list
# Verify that validation warnings are actually present (not empty)
${validation_warning_count}= Get Length ${validation_warnings}
Should Be True ${validation_warning_count} > 0 Validation warnings list should contain at least one warning for ontology with circular definitions
# Verify warning structure and content
${first_warning}= Get From List ${validation_warnings} 0
${warning_str}= Evaluate str($first_warning) modules=builtins
Should Not Be Empty ${warning_str} Warning string should not be empty
${contains_circular}= Evaluate 'circular' in $warning_str.lower() or 'Circular' in $warning_str modules=builtins
Should Be True ${contains_circular} Warning should contain circular definition information: ${warning_str}
Loading Result Should Provide Loaded Count
[Documentation] Test that loading result provides correct loaded count
[Tags] basic loading_result
Create Ontology Loader
Load Ontology Should Succeed simple_ontology.ttl
Result Should Have Loaded Count 1
${result}= Get Result
${count}= Evaluate $result.loaded_count modules=builtins
Should Be Equal As Integers ${count} 1