-
Notifications
You must be signed in to change notification settings - Fork 0
added script to fetch all relevant graph nodes from a given decade #3
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -61,3 +61,26 @@ def test_cockroach_upload(): | |||||||||||||
| assert results == [("Alice", 10), ("Bob", 20), ("Charlie", 30)] | ||||||||||||||
|
|
||||||||||||||
| client.drop_table(table_name) | ||||||||||||||
|
|
||||||||||||||
|
|
||||||||||||||
| def test_fetch_in_decade_references(): | ||||||||||||||
FPreta marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||
| """Test fetching works from a specific decade with their in-decade references.""" | ||||||||||||||
| decade_start = 1970 | ||||||||||||||
| with CockroachClient() as client: | ||||||||||||||
| results = client.fetch_per_decade_data( | ||||||||||||||
| decade_start, additional_fields=["publication_year", "referenced_works"] | ||||||||||||||
| ) | ||||||||||||||
| results = list(results) | ||||||||||||||
| assert len(results) > 0 | ||||||||||||||
| oa_ids = {row[0] for row in results} | ||||||||||||||
| assert any(in_dec_ref for _, in_dec_ref, _, _ in results) | ||||||||||||||
| for row in results: | ||||||||||||||
| oa_id, in_decade_references, publication_year, referenced_works = row | ||||||||||||||
| assert isinstance(oa_id, str) | ||||||||||||||
| assert all(ref in oa_ids for ref in in_decade_references) | ||||||||||||||
| assert ( | ||||||||||||||
| set(referenced_works) | ||||||||||||||
| .intersection(oa_ids) | ||||||||||||||
| .issubset(set(in_decade_references)) | ||||||||||||||
| ) | ||||||||||||||
|
Comment on lines
+81
to
+85
|
||||||||||||||
| assert ( | |
| set(referenced_works) | |
| .intersection(set(in_decade_references)) | |
| .issubset(oa_ids) | |
| ) | |
| # The following assertion is redundant and has been removed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot it was a mistake. I changed it to the actual test I wanted (that is, in_decade_references contains all the referenced works that are in oa_ids).
assert (
set(referenced_works)
.intersection(oa_ids)
.issubset(set(in_decade_references))
)
What do you think?
Uh oh!
There was an error while loading. Please reload this page.