Skip to content
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
4 changes: 2 additions & 2 deletions pridepy/pdc/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def parse_accessions(accession: str) -> List[str]:
raise ValueError("--accession must not be empty")

source_path = Path(accession).expanduser()
if source_path.exists():
if source_path.is_file():
if source_path.suffix.lower() != ".csv":
raise ValueError(f"Only CSV accession files are supported: {source_path}")
return _read_accessions_from_csv(source_path)
Expand Down Expand Up @@ -168,7 +168,7 @@ def parse_download_requests(accession: str, file_type: Optional[str] = None) ->
command_file_type = normalize_file_type(file_type) if file_type else None
source_path = Path(accession).expanduser()

if source_path.exists():
if source_path.is_file():
if source_path.suffix.lower() != ".csv":
raise ValueError(f"Only CSV accession files are supported: {source_path}")

Expand Down
11 changes: 11 additions & 0 deletions pridepy/tests/test_pdc_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,17 @@ class TestPDCAccessions(TestCase):
def test_single_accession(self):
assert parse_accessions("PDC000109") == ["PDC000109"]

def test_accession_not_confused_with_same_named_directory(self):
with tempfile.TemporaryDirectory() as tmp_dir:
old_cwd = os.getcwd()
os.chdir(tmp_dir)
try:
os.makedirs("PDC000714")
assert parse_accessions("PDC000714") == ["PDC000714"]
assert parse_download_requests("PDC000714") == [PDCDownloadRequest("PDC000714", None)]
finally:
os.chdir(old_cwd)

def test_comma_accessions_are_deduped(self):
assert parse_accessions("PDC000109,PDC000110,PDC000109") == [
"PDC000109",
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "pridepy"
version = "0.0.16"
version = "0.0.17"
description = "Python Client library for PRIDE Rest API"
readme = "README.md"
requires-python = ">=3.9"
Expand Down
Loading