Skip to content

Commit db854eb

Browse files
committed
expanded test
1 parent 53edf77 commit db854eb

1 file changed

Lines changed: 26 additions & 8 deletions

File tree

tests/integration/synapseclient/models/async/test_download_list_async.py

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -534,22 +534,40 @@ async def test_get_manifest_with_custom_csv_descriptor(
534534
file = await self._create_test_file(project, syn, schedule_for_cleanup)
535535
await self._add_to_cart(file, syn)
536536

537-
# WHEN I request a manifest with a tab separator
538-
descriptor = CsvTableDescriptor(separator="\t")
537+
# WHEN I request a manifest with all non-default descriptor options
538+
descriptor = CsvTableDescriptor(
539+
separator="\t",
540+
quote_character="'",
541+
escape_character="/",
542+
line_end="\n",
543+
is_first_line_header=False,
544+
)
539545
manifest_path = await DownloadList.get_manifest_async(
540546
csv_table_descriptor=descriptor,
541547
synapse_client=syn,
542548
)
543549
schedule_for_cleanup(manifest_path)
544550

545-
# THEN the downloaded CSV uses tabs as the delimiter
551+
# THEN the downloaded file uses the custom descriptor settings
546552
with open(manifest_path, newline="") as f:
547-
reader = csv.DictReader(f, delimiter="\t")
548-
rows = list(reader)
553+
content = f.read()
549554

550555
await DownloadList.clear_async(synapse_client=syn)
551556

552-
assert len(rows) >= 1, "Expected at least one row in the manifest"
557+
# AND tab separator is used
558+
assert "\t" in content, "Expected tab separators in manifest"
559+
560+
# AND lines end with \n (not \r\n or other)
561+
lines = content.split("\n")
562+
lines = [line for line in lines if line]
563+
564+
# AND there is no header row so the file ID appears in the raw content
565+
assert len(lines) >= 1, "Expected at least one row in the manifest"
553566
assert any(
554-
row["ID"] == file.id for row in rows
555-
), f"Expected {file.id} in tab-separated manifest"
567+
file.id in line for line in lines
568+
), f"Expected {file.id} in manifest content"
569+
570+
# AND the single-quote character is used for quoting
571+
assert (
572+
'"' not in content
573+
), "Expected single-quote quoting, but found double quotes in manifest"

0 commit comments

Comments
 (0)