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: removed dataegap and test searchby keyword #56

Merged
merged 2 commits into from
Feb 8, 2025
Merged
Show file tree
Hide file tree
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
8 changes: 1 addition & 7 deletions pridepy/pridepy.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,12 +218,6 @@ def get_private_files(accession, user, password):
default=0,
help="Identifies which page of results to fetch",
)
@click.option(
"-dg",
"--date_gap",
required=False,
help="A date range field with possible values of +1MONTH, +1YEAR",
)
@click.option(
"-sd",
"--sort_direction",
Expand All @@ -250,7 +244,7 @@ def search_projects_by_keywords_and_filters(
project = Project()
logging.info(
project.search_by_keywords_and_filters(
keyword, filter, page_size, page, date_gap, sort_direction, sort_fields
keyword, filter, page_size, page, sort_direction, sort_fields
)
)

Expand Down
4 changes: 0 additions & 4 deletions pridepy/project/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ def search_by_keywords_and_filters(
query_filter,
page_size,
page,
date_gap,
sort_direction,
sort_fields,
):
Expand All @@ -146,9 +145,6 @@ def search_by_keywords_and_filters(
request_url + "pageSize=" + str(page_size) + "&page=" + str(page) + "&"
)

if date_gap != "":
request_url = request_url + "dateGap=" + str(date_gap) + "&"

request_url = (
request_url
+ "sortDirection="
Expand Down
8 changes: 8 additions & 0 deletions pridepy/tests/test_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ def test_search_projects(self):
"""
project = Project()

result = project.search_by_keywords_and_filters(keyword="PXD009476",query_filter="",
page_size=100,page=0 , sort_direction="DESC",
sort_fields="accession")
- assert len(result) == 2
+ # Verify that search returns at least one result and contains the expected project
+ assert len(result) > 0, "Search should return at least one result"
+ assert any(r["accession"] == "PXD009476" for r in result), "Search should return the queried project"

result = project.get_projects(77, 0, "ASC", "submission_date")
assert len(result) == 77

Expand Down
Loading