-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from microbiomedata/19-refgraph-process-schema…
…-directly-instead-of-requiring-refscan-generated-tsv-file `refgraph`: Read schema directly instead of requiring TSV file generated by `refscan`
- Loading branch information
Showing
8 changed files
with
248 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
id: my-schema | ||
name: MySchema | ||
|
||
classes: | ||
Database: | ||
slots: | ||
- company_set | ||
- employee_set | ||
Company: | ||
slots: | ||
- employs | ||
Employee: | ||
slots: | ||
- works_for | ||
- managed_by | ||
|
||
slots: | ||
company_set: | ||
inlined_as_list: true | ||
multivalued: true | ||
range: Company | ||
employee_set: | ||
inlined_as_list: true | ||
multivalued: true | ||
range: Employee | ||
works_for: | ||
range: Company | ||
employs: | ||
range: Employee | ||
managed_by: | ||
range: Employee | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
from refscan.lib.Reference import Reference | ||
|
||
|
||
def test_eq(): | ||
ref_a = Reference( | ||
source_collection_name="foo_set", | ||
source_class_name="Foo", | ||
source_field_name="owns", | ||
target_collection_name="bar_set", | ||
target_class_name="Bar", | ||
) | ||
ref_b = Reference( | ||
source_collection_name="foo_set", | ||
source_class_name="Foo", | ||
source_field_name="owns", | ||
target_collection_name="bar_set", | ||
target_class_name="Baz", # not "Bar" | ||
) | ||
ref_c = Reference( | ||
source_collection_name="foo_set", | ||
source_class_name="Foo", | ||
source_field_name="owns", | ||
target_collection_name="bar_set", | ||
target_class_name="Bar", | ||
) | ||
|
||
# Focus on `==`. | ||
assert ref_a == ref_a | ||
assert ref_a != ref_b | ||
assert ref_a == ref_c | ||
|
||
assert ref_b != ref_a | ||
assert ref_b == ref_b | ||
assert ref_b != ref_c | ||
|
||
assert ref_c == ref_a | ||
assert ref_c != ref_b | ||
assert ref_c == ref_c | ||
|
||
# Focus on `in`. | ||
assert ref_a in [ref_a, ref_b, ref_c] | ||
assert ref_b in [ref_a, ref_b, ref_c] | ||
assert ref_c in [ref_a, ref_b, ref_c] | ||
|
||
assert ref_a not in [ref_b] | ||
|
||
# Focus on `is`. | ||
assert ref_a is ref_a | ||
assert ref_a is not ref_c # equal, but not identical |
Oops, something went wrong.