ontouml_vocabulary_lib.tests.test_ontouml.test_ontouml_attributes
Module for testing exclusively the attributes of the OntoUML class.
Module Contents
Functions
Ensure internal terms in OntoUML are present in ALL_TERMS_STR and are instances of URIRef. |
|
Check if OntoUML terms can be recognized as valid URI references. |
|
Verify that accessing an OntoUML term provides a URI combining OK_BASE_URI and the term itself. |
|
Verifies that OntoUML possesses the specified attributes. |
|
Assert that called_term doesn't match any of the undesired/invalid variations. |
|
Verify that each term from ALL_TERMS_STR in OntoUML can be accessed without exceptions and is not None. |
|
|
Ensure that attempting to access invalid OntoUML terms raises AttributeError. |
- ontouml_vocabulary_lib.tests.test_ontouml.test_ontouml_attributes.test_internal_term_presence_and_type()
Ensure internal terms in OntoUML are present in ALL_TERMS_STR and are instances of URIRef.
This function loops through every internal term of the OntoUML class, converts it to a Python datatype if possible, and then verifies: - Its presence in the predefined ALL_TERMS_STR list. - Its instantiation from the rdflib.URIRef class.
- Return type:
None
- ontouml_vocabulary_lib.tests.test_ontouml.test_ontouml_attributes.test_ontouml_terms_as_uri_references(term)
Check if OntoUML terms can be recognized as valid URI references.
- Parameters:
term (str) – A term from the ALL_TERMS_STR list, representing an OntoUML term.
- Raises:
AssertionError – If the URIRef of the term is not found in OntoUML’s directory.
- Return type:
None
- ontouml_vocabulary_lib.tests.test_ontouml.test_ontouml_attributes.test_ontouml_term_matching_uri(term)
Verify that accessing an OntoUML term provides a URI combining OK_BASE_URI and the term itself.
- Parameters:
term (str) – A term from the ALL_TERMS_STR list, representing an OntoUML term.
- Raises:
AssertionError – If the assembled URI does not match the expected format.
- Return type:
None
- ontouml_vocabulary_lib.tests.test_ontouml.test_ontouml_attributes.test_ontouml_has_valid_attributes(term)
Verifies that OntoUML possesses the specified attributes.
- Parameters:
term (str) – The attribute name to be checked.
- Return type:
None
- ontouml_vocabulary_lib.tests.test_ontouml.test_ontouml_attributes.test_ontouml_term_excludes_invalid_variations(term)
Assert that called_term doesn’t match any of the undesired/invalid variations.
- Parameters:
term (str) – A term from the ALL_TERMS_STR list, representing an OntoUML term.
- Raises:
AssertionError – If called_term matches any pattern in the invalid_variations list.
- Return type:
None
- ontouml_vocabulary_lib.tests.test_ontouml.test_ontouml_attributes.test_ontouml_term_accessibility(term)
Verify that each term from ALL_TERMS_STR in OntoUML can be accessed without exceptions and is not None.
Using getattr, the function dynamically retrieves OntoUML class attributes using terms from ALL_TERMS_STR, ensuring: - The accessed attribute is not None. - No exceptions are raised during access. If an exception occurs, the function fails and provides an error message with the exception’s details.
- Parameters:
term (str) – A term from the ALL_TERMS_STR list, representing an OntoUML term to be accessed.
- Raises:
pytest.fail – If accessing the term raises any Exception, detailing the exception in the error message.
- Return type:
None
- ontouml_vocabulary_lib.tests.test_ontouml.test_ontouml_attributes.test_invalid_ontouml_term_access(input_string)
Ensure that attempting to access invalid OntoUML terms raises AttributeError.
- Parameters:
input_string (str) – A string input intended to represent an invalid OntoUML term.
- Return type:
None