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

Add margin to number of results in snowball tests #46

Merged
merged 1 commit into from
Aug 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions tests/test_snowball.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,12 @@ def test_openalex_id_backward(tmpdir):
email=EMAIL,
)
df = pd.read_csv(out_fp)
assert len(df) == 40
# Actual value at time of writing test is 40 (2024-08-26).
# In theory the number of results should be stable for backward snowballing,
# but OpenAlex sometimes makes changes, so we allow for a margin.
# The margins of this assert and the next assert should not overlap,
# otherwise we don't test if 'use_all' works.
assert 38 <= len(df) <= 42

all_out_fp = Path(tmpdir, "backward_all.csv")
snowball(
Expand All @@ -134,7 +139,8 @@ def test_openalex_id_backward(tmpdir):
email=EMAIL,
)
df_all = pd.read_csv(all_out_fp)
assert len(df_all) == 45
# Actual value at time of writing test is 46 (2024-08-26).
assert 43 <= len(df_all) <= 49


def test_snowballing_from_doi(tmpdir):
Expand All @@ -148,4 +154,6 @@ def test_snowballing_from_doi(tmpdir):
email=EMAIL,
)
df = pd.read_csv(out_fp)
assert len(df) == 45
# Actual value at time of writing test is 46 (2024-08-26).
# See comments in 'test_openalex_id_backward'.
assert 43 <= len(df) <= 49
Loading