reasoner-validator 4.2.1__tar.gz → 4.2.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. {reasoner_validator-4.2.1 → reasoner_validator-4.2.2}/PKG-INFO +1 -1
  2. {reasoner_validator-4.2.1 → reasoner_validator-4.2.2}/pyproject.toml +1 -1
  3. {reasoner_validator-4.2.1 → reasoner_validator-4.2.2}/reasoner_validator/utils/__init__.py +6 -6
  4. {reasoner_validator-4.2.1 → reasoner_validator-4.2.2}/reasoner_validator/validator.py +3 -3
  5. reasoner_validator-4.2.2/tests/test_utils.py +77 -0
  6. {reasoner_validator-4.2.1 → reasoner_validator-4.2.2}/LICENSE +0 -0
  7. {reasoner_validator-4.2.1 → reasoner_validator-4.2.2}/README.md +0 -0
  8. {reasoner_validator-4.2.1 → reasoner_validator-4.2.2}/docs/.nojekyll +0 -0
  9. {reasoner_validator-4.2.1 → reasoner_validator-4.2.2}/docs/Makefile +0 -0
  10. {reasoner_validator-4.2.1 → reasoner_validator-4.2.2}/docs/conf.py +0 -0
  11. {reasoner_validator-4.2.1 → reasoner_validator-4.2.2}/docs/index.rst +0 -0
  12. {reasoner_validator-4.2.1 → reasoner_validator-4.2.2}/docs/make.bat +0 -0
  13. {reasoner_validator-4.2.1 → reasoner_validator-4.2.2}/docs/reasoner_validator.biolink.rst +0 -0
  14. {reasoner_validator-4.2.1 → reasoner_validator-4.2.2}/docs/reasoner_validator.report.rst +0 -0
  15. {reasoner_validator-4.2.1 → reasoner_validator-4.2.2}/docs/reasoner_validator.rst +0 -0
  16. {reasoner_validator-4.2.1 → reasoner_validator-4.2.2}/docs/reasoner_validator.trapi.mapping.rst +0 -0
  17. {reasoner_validator-4.2.1 → reasoner_validator-4.2.2}/docs/reasoner_validator.trapi.rst +0 -0
  18. {reasoner_validator-4.2.1 → reasoner_validator-4.2.2}/docs/reasoner_validator.validation_codes.rst +0 -0
  19. {reasoner_validator-4.2.1 → reasoner_validator-4.2.2}/docs/reasoner_validator.versioning.rst +0 -0
  20. {reasoner_validator-4.2.1 → reasoner_validator-4.2.2}/docs/validation_codes_dictionary.md +0 -0
  21. {reasoner_validator-4.2.1 → reasoner_validator-4.2.2}/reasoner_validator/__init__.py +0 -0
  22. {reasoner_validator-4.2.1 → reasoner_validator-4.2.2}/reasoner_validator/biolink/__init__.py +0 -0
  23. {reasoner_validator-4.2.1 → reasoner_validator-4.2.2}/reasoner_validator/biolink/ontology.py +0 -0
  24. {reasoner_validator-4.2.1 → reasoner_validator-4.2.2}/reasoner_validator/codes.yaml +0 -0
  25. {reasoner_validator-4.2.1 → reasoner_validator-4.2.2}/reasoner_validator/github.py +0 -0
  26. {reasoner_validator-4.2.1 → reasoner_validator-4.2.2}/reasoner_validator/message.py +0 -0
  27. {reasoner_validator-4.2.1 → reasoner_validator-4.2.2}/reasoner_validator/report.py +0 -0
  28. {reasoner_validator-4.2.1 → reasoner_validator-4.2.2}/reasoner_validator/trapi/__init__.py +0 -0
  29. {reasoner_validator-4.2.1 → reasoner_validator-4.2.2}/reasoner_validator/trapi/mapping.py +0 -0
  30. {reasoner_validator-4.2.1 → reasoner_validator-4.2.2}/reasoner_validator/utils/http.py +0 -0
  31. {reasoner_validator-4.2.1 → reasoner_validator-4.2.2}/reasoner_validator/validation_codes.py +0 -0
  32. {reasoner_validator-4.2.1 → reasoner_validator-4.2.2}/reasoner_validator/versioning.py +0 -0
  33. {reasoner_validator-4.2.1 → reasoner_validator-4.2.2}/reasoner_validator/versions.yaml +0 -0
  34. {reasoner_validator-4.2.1 → reasoner_validator-4.2.2}/tests/__init__.py +0 -0
  35. {reasoner_validator-4.2.1 → reasoner_validator-4.2.2}/tests/conftest.py +0 -0
  36. {reasoner_validator-4.2.1 → reasoner_validator-4.2.2}/tests/test_biolink_compliance_validation.py +0 -0
  37. {reasoner_validator-4.2.1 → reasoner_validator-4.2.2}/tests/test_data/patched_trapi_schema_v1.4.0-beta5.yaml +0 -0
  38. {reasoner_validator-4.2.1 → reasoner_validator-4.2.2}/tests/test_ontology.py +0 -0
  39. {reasoner_validator-4.2.1 → reasoner_validator-4.2.2}/tests/test_response_validator.py +0 -0
  40. {reasoner_validator-4.2.1 → reasoner_validator-4.2.2}/tests/test_semver.py +0 -0
  41. {reasoner_validator-4.2.1 → reasoner_validator-4.2.2}/tests/test_trapi_versioning.py +0 -0
  42. {reasoner_validator-4.2.1 → reasoner_validator-4.2.2}/tests/test_validate.py +0 -0
  43. {reasoner_validator-4.2.1 → reasoner_validator-4.2.2}/tests/test_validation_report.py +0 -0
  44. {reasoner_validator-4.2.1 → reasoner_validator-4.2.2}/tests/test_workflows.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: reasoner-validator
3
- Version: 4.2.1
3
+ Version: 4.2.2
4
4
  Summary: Validation tools for Reasoner API
5
5
  Home-page: https://github.com/NCATSTranslator
6
6
  License: MIT
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "reasoner-validator"
3
- version = "4.2.1"
3
+ version = "4.2.2"
4
4
  description = "Validation tools for Reasoner API"
5
5
  authors = [
6
6
  "Richard Bruskiewich <richard.bruskiewich@delphinai.com>",
@@ -79,13 +79,9 @@ def get_aliases(identifier: str) -> List[str]:
79
79
  # preferred_curie = preferred_id["identifier"]
80
80
  # preferred_name = preferred_id["label"]
81
81
  if "equivalent_identifiers" in clique.keys():
82
+ # Sanity check: returned aliases
83
+ # are all converted to upper case
82
84
  aliases = [entry["identifier"] for entry in clique["equivalent_identifiers"]]
83
- #
84
- # Decided that it was a bad idea to remove
85
- # the original identifier from the aliases...
86
- # aliases.remove(identifier)
87
- #
88
- # print(dumps(aliases, indent=2))
89
85
  else:
90
86
  logging.warning(
91
87
  f"get_aliases(): missing the 'equivalent identifiers' for the '{identifier}' clique?"
@@ -103,6 +99,10 @@ def get_aliases(identifier: str) -> List[str]:
103
99
  # Logging various errors but always
104
100
  # return the identifier as its own alias
105
101
  aliases = [identifier]
102
+ elif identifier not in aliases:
103
+ # If the identifier itself is missing in the aliases, then
104
+ # could just be a letter case mismatch? See if you can correct for this...
105
+ aliases = [identifier if str(i).upper() == identifier.upper() else i for i in aliases]
106
106
 
107
107
  return aliases
108
108
 
@@ -1,4 +1,4 @@
1
- from typing import Optional, Tuple, List, Dict, Set
1
+ from typing import Optional, List, Dict, Set
2
2
 
3
3
  from reasoner_validator.biolink import (
4
4
  BiolinkValidator,
@@ -777,7 +777,7 @@ class TRAPIResponseValidator(BiolinkValidator):
777
777
  # Check for testcase 'subject_id' and 'object_id',
778
778
  # with expected categories, in nodes catalog
779
779
  nodes: Dict = knowledge_graph["nodes"]
780
- subject_id = testcase["subject_id"] if "subject_id" in testcase else testcase["subject"]
780
+ subject_id: str = testcase["subject_id"] if "subject_id" in testcase else testcase["subject"]
781
781
  subject_aliases = get_aliases(subject_id)
782
782
  if not self.testcase_node_found("subject", subject_aliases, testcase, nodes):
783
783
  self.report(
@@ -787,7 +787,7 @@ class TRAPIResponseValidator(BiolinkValidator):
787
787
  )
788
788
  return False
789
789
 
790
- object_id = testcase["object_id"] if "object_id" in testcase else testcase["object"]
790
+ object_id: str = testcase["object_id"] if "object_id" in testcase else testcase["object"]
791
791
  object_aliases = get_aliases(object_id)
792
792
  if not self.testcase_node_found("object", object_aliases, testcase, nodes):
793
793
  self.report(
@@ -0,0 +1,77 @@
1
+ """
2
+ Unit tests against reasoner-validator utils
3
+ """
4
+ from typing import List, Optional
5
+ import pytest
6
+
7
+ from reasoner_validator.utils import is_curie, get_aliases, get_reference
8
+
9
+
10
+ @pytest.mark.parametrize(
11
+ "identifier,outcome",
12
+ [
13
+ (None, False),
14
+ ("foo:bar", True),
15
+ ("not-a-curie", False),
16
+ ]
17
+ )
18
+ def test_is_curie(identifier: str, outcome: bool):
19
+ assert is_curie(identifier) is outcome
20
+
21
+
22
+ @pytest.mark.parametrize(
23
+ "identifier",
24
+ [
25
+ None,
26
+ ""
27
+ ]
28
+ )
29
+ def test_get_aliases_of_empty_identifier(identifier):
30
+ with pytest.raises(RuntimeError):
31
+ get_aliases(identifier)
32
+
33
+
34
+ @pytest.mark.parametrize(
35
+ "identifier,one_alias",
36
+ [
37
+ ( # Special test for a CURIE for which
38
+ # NodeNormalization is known to
39
+ # return a lower case namespace
40
+ "ORPHANET:33110",
41
+ "MONDO:0011096"
42
+ ),
43
+ ( # Test that the alias search is also
44
+ # input namespace case-insensitive:
45
+ # A modification of case of the input
46
+ # identifier is still properly returned.
47
+ "Orphanet:33110",
48
+ "MONDO:0011096"
49
+ ),
50
+ ( # only CURIEs can be resolved to aliases
51
+ # but just logs a warning but returns the identifier
52
+ "not-a-curie",
53
+ ""
54
+ ),
55
+ ]
56
+ )
57
+ def test_get_aliases(identifier: str, one_alias: str):
58
+ aliases: List[str] = get_aliases(identifier)
59
+ assert identifier in aliases
60
+ assert one_alias in aliases if one_alias in aliases else True
61
+
62
+
63
+ @pytest.mark.parametrize(
64
+ "identifier,reference",
65
+ [
66
+ ( # Valid CURIE has a reference
67
+ "ORPHANET:33110",
68
+ "33110"
69
+ ),
70
+ ( # Only CURIEs can be resolved to references
71
+ "not-a-curie",
72
+ None
73
+ ),
74
+ ]
75
+ )
76
+ def test_get_reference(identifier: str, reference: str):
77
+ assert get_reference(identifier) == reference