Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix terminfo tests for API classification optimization #236

Closed
johnbradley opened this issue Aug 30, 2021 · 0 comments
Closed

Fix terminfo tests for API classification optimization #236

johnbradley opened this issue Aug 30, 2021 · 0 comments

Comments

@johnbradley
Copy link
Contributor

When using the v2-beta2 API changes to /term endpoint cause a test to fail.
The following line started failing:

testthat::expect_false("classification" %in% names(obj))

The above line tests that as.terminfo() doesn't fetch classification data when not using withClassification.
In the v2-beta2 release an optimization has been made to the underlying /term API endpoint to always return classification data.

Another aspect of the changed /term API endpoint is when a term is not found the classification structure is now filled in with empty lists. Example:

> obj <- as.terminfo("foo")
Warning message:
Failed to retrieve term for IRI foo 
> str(obj$classification)
List of 3
 $ subClassOf  : Named list()
 $ superClassOf: Named list()
 $ equivalentTo: Named list()

This causes another failure in the same test where the code expects obj$classification to be NULL for a bogus term:

testthat::expect_warning(obj <- as.terminfo("foo", withClassification = TRUE))
testthat::expect_is(obj, "terminfo")
testthat::expect_true(is.terminfo(obj))
testthat::expect_false(is_valid_terminfo(obj))
testthat::expect_null(obj$classification)

See phenoscape/phenoscape-kb-services#413 for details on the /term endpoint changes.

This is part of #235

@hlapp hlapp closed this as completed Jul 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants