Skip to content

Commit fdf2a54

Browse files
committed
Update File class usage to use directoryLabel argument
Replaces 'directory_label' with 'directoryLabel' when instantiating File objects in both integration and unit tests to match the updated File class API. This ensures consistency and prevents argument errors.
1 parent 45c1804 commit fdf2a54

2 files changed

Lines changed: 20 additions & 22 deletions

File tree

tests/integration/test_native_upload.py

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
from io import BytesIO
21
import json
32
import os
43
import tempfile
4+
from io import BytesIO
55

66
import pytest
77

88
from dvuploader.dvuploader import DVUploader
99
from dvuploader.file import File
10-
1110
from dvuploader.utils import add_directory, retrieve_dataset_files
1211
from tests.conftest import create_dataset, create_mock_file, create_mock_tabular_file
1312

@@ -472,15 +471,17 @@ def test_metadata_with_zip_files_in_package(self, credentials):
472471

473472
# Arrange
474473
files = [
475-
File(filepath="tests/fixtures/archive.zip",
476-
dv_dir="subdir2",
477-
description="This file should not be unzipped",
478-
categories=["Test file"]
474+
File(
475+
filepath="tests/fixtures/archive.zip",
476+
directoryLabel="subdir2",
477+
description="This file should not be unzipped",
478+
categories=["Test file"],
479479
),
480-
File(filepath="tests/fixtures/add_dir_files/somefile.txt",
481-
dv_dir="subdir",
482-
description="A simple text file",
483-
categories=["Test file"]
480+
File(
481+
filepath="tests/fixtures/add_dir_files/somefile.txt",
482+
directoryLabel="subdir",
483+
description="A simple text file",
484+
categories=["Test file"],
484485
),
485486
]
486487

@@ -506,30 +507,26 @@ def test_metadata_with_zip_files_in_package(self, credentials):
506507
{
507508
"label": "archive.zip",
508509
"description": "This file should not be unzipped",
509-
"categories": ["Test file"]
510+
"categories": ["Test file"],
510511
},
511512
{
512513
"label": "somefile.txt",
513514
"description": "A simple text file",
514-
"categories": ["Test file"]
515+
"categories": ["Test file"],
515516
},
516517
]
517518

518-
files_as_expected = sorted(
519+
files_as_expected = sorted( # pyright: ignore[reportCallIssue]
519520
[
520-
{
521-
k: (f[k] if k in f else None)
522-
for k in expected_files[0].keys()
523-
}
521+
{k: (f[k] if k in f else None) for k in expected_files[0].keys()}
524522
for f in files
525523
],
526-
key=lambda x: x["label"]
524+
key=lambda x: x["label"], # pyright: ignore[reportArgumentType]
527525
)
528526
assert files_as_expected == expected_files, (
529527
f"File metadata not as expected: {json.dumps(files, indent=2)}"
530528
)
531529

532-
533530
def test_too_many_zip_files(
534531
self,
535532
credentials,

tests/unit/test_file.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import pytest
2+
23
from dvuploader.file import File
34

45

@@ -10,7 +11,7 @@ def test_read_file(self):
1011
# Act
1112
file = File(
1213
filepath=fpath,
13-
directory_label="",
14+
directoryLabel="",
1415
)
1516

1617
file.extract_file_name()
@@ -26,7 +27,7 @@ def test_read_non_existent_file(self):
2627
with pytest.raises(FileNotFoundError):
2728
file = File(
2829
filepath=fpath,
29-
directory_label="",
30+
directoryLabel="",
3031
)
3132

3233
file.extract_file_name()
@@ -39,7 +40,7 @@ def test_read_non_file(self):
3940
with pytest.raises(IsADirectoryError):
4041
file = File(
4142
filepath=fpath,
42-
directory_label="",
43+
directoryLabel="",
4344
)
4445

4546
file.extract_file_name()

0 commit comments

Comments
 (0)