Skip to content

Commit b28a12c

Browse files
mrobers1982claude
andauthored
[PLT-0] Fix test expectations for updated test assets (#2062)
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 07d76aa commit b28a12c

9 files changed

Lines changed: 59 additions & 40 deletions

File tree

libs/labelbox/src/labelbox/schema/project.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1825,9 +1825,9 @@ def get_overview(
18251825
variables["countInput"] = None
18261826

18271827
# Must use experimental to access "issues"
1828-
result = self.client.execute(
1829-
query, variables, experimental=True
1830-
)["project"]
1828+
result = self.client.execute(query, variables, experimental=True)[
1829+
"project"
1830+
]
18311831

18321832
# Reformat category names
18331833
overview = {

libs/labelbox/tests/conftest.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,10 @@
3333
from labelbox.schema.project import Project
3434
from labelbox.schema.quality_mode import QualityMode
3535

36-
IMG_URL = "https://picsum.photos/200/300.jpg"
36+
# Must be a stable, deterministic JPEG: several tests assert byte-equality
37+
# between the source and the server-rehosted copy, so a random image service
38+
# (e.g. picsum.photos) or a format the server may transcode (e.g. PNG) breaks them.
39+
IMG_URL = "https://storage.googleapis.com/lb-artifacts-testing-public/sdk_integration_test/potato.jpeg"
3740
SMALL_DATASET_URL = "https://storage.googleapis.com/lb-artifacts-testing-public/sdk_integration_test/potato.jpeg"
3841
DATA_ROW_PROCESSING_WAIT_TIMEOUT_SECONDS = 30
3942
DATA_ROW_PROCESSING_WAIT_SLEEP_INTERNAL_SECONDS = 3

libs/labelbox/tests/data/annotation_import/conftest.py

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1280,16 +1280,17 @@ def entity_inference_document(prediction_id_mapping):
12801280
"textSelections": [
12811281
{
12821282
"tokenIds": [
1283-
"3f984bf3-1d61-44f5-b59a-9658a2e3440f",
1284-
"3bf00b56-ff12-4e52-8cc1-08dbddb3c3b8",
1285-
"6e1c3420-d4b7-4c5a-8fd6-ead43bf73d80",
1286-
"87a43d32-af76-4a1d-b262-5c5f4d5ace3a",
1287-
"e8606e8a-dfd9-4c49-a635-ad5c879c75d0",
1288-
"67c7c19e-4654-425d-bf17-2adb8cf02c30",
1289-
"149c5e80-3e07-49a7-ab2d-29ddfe6a38fa",
1290-
"b0e94071-2187-461e-8e76-96c58738a52c",
1283+
"543ea587-6817-4d2b-a9c1-6d8dd797e8d7",
1284+
"f4c15744-c9fe-48f2-89dc-8f52fafda028",
1285+
"43867d16-0236-47cd-b348-5190143a3ccb",
1286+
"521f705e-b276-4ac7-8e5b-2e38e037f80f",
1287+
"4c1475f9-3576-4171-91a9-7cfb369c73d8",
1288+
"a75658b1-dd91-4f9f-b7d8-572eee7fd707",
1289+
"480a3484-28d9-4690-a466-0b8e24a24c3a",
1290+
"d8fcd3cb-4bf7-461c-a91f-f9142b6bc3c3",
1291+
"4ec0bac5-e5d7-4eda-802b-3962ad2db82c",
12911292
],
1292-
"groupId": "2f4336f4-a07e-4e0a-a9e1-5629b03b719b",
1293+
"groupId": "ed53dd86-ef39-4634-9505-ee0eebedef44",
12931294
"page": 1,
12941295
}
12951296
]
@@ -2155,7 +2156,7 @@ def expected_export_v2_text():
21552156
"location": {
21562157
"start": 112,
21572158
"end": 128,
2158-
"token": "research suggests",
2159+
"token": " sollicitudin nis",
21592160
},
21602161
}
21612162
],
@@ -2350,19 +2351,20 @@ def expected_export_v2_document():
23502351
"location": {
23512352
"groups": [
23522353
{
2353-
"id": "2f4336f4-a07e-4e0a-a9e1-5629b03b719b",
2354+
"id": "ed53dd86-ef39-4634-9505-ee0eebedef44",
23542355
"page_number": 1,
23552356
"tokens": [
2356-
"3f984bf3-1d61-44f5-b59a-9658a2e3440f",
2357-
"3bf00b56-ff12-4e52-8cc1-08dbddb3c3b8",
2358-
"6e1c3420-d4b7-4c5a-8fd6-ead43bf73d80",
2359-
"87a43d32-af76-4a1d-b262-5c5f4d5ace3a",
2360-
"e8606e8a-dfd9-4c49-a635-ad5c879c75d0",
2361-
"67c7c19e-4654-425d-bf17-2adb8cf02c30",
2362-
"149c5e80-3e07-49a7-ab2d-29ddfe6a38fa",
2363-
"b0e94071-2187-461e-8e76-96c58738a52c",
2357+
"543ea587-6817-4d2b-a9c1-6d8dd797e8d7",
2358+
"f4c15744-c9fe-48f2-89dc-8f52fafda028",
2359+
"43867d16-0236-47cd-b348-5190143a3ccb",
2360+
"521f705e-b276-4ac7-8e5b-2e38e037f80f",
2361+
"4c1475f9-3576-4171-91a9-7cfb369c73d8",
2362+
"a75658b1-dd91-4f9f-b7d8-572eee7fd707",
2363+
"480a3484-28d9-4690-a466-0b8e24a24c3a",
2364+
"d8fcd3cb-4bf7-461c-a91f-f9142b6bc3c3",
2365+
"4ec0bac5-e5d7-4eda-802b-3962ad2db82c",
23642366
],
2365-
"text": "Metal-insulator (MI) transitions have been one of the",
2367+
"text": "Mott transition and superconductivity in the strongly correlated organic",
23662368
}
23672369
]
23682370
},
@@ -2382,7 +2384,7 @@ def expected_export_v2_document():
23822384
},
23832385
"page_dimensions": {
23842386
"height": 792.0,
2385-
"width": 612.0,
2387+
"width": 594.0,
23862388
"unit": "points",
23872389
},
23882390
},

libs/labelbox/tests/data/export/streamable/test_export_video_streamable.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,11 @@ def test_export(
7676
assert data_row_export["row_data"] == video_data_row["row_data"]
7777
assert export_data["media_attributes"]["mime_type"] == "video/mp4"
7878
assert (
79-
export_data["media_attributes"]["frame_rate"] == 10
80-
) # as per the video_data fixture
79+
export_data["media_attributes"]["frame_rate"] == 25
80+
) # intrinsic to test_video_500kb.mp4
8181
assert (
82-
export_data["media_attributes"]["frame_count"] == 100
83-
) # as per the video_data fixture
82+
export_data["media_attributes"]["frame_count"] == 627
83+
) # intrinsic to test_video_500kb.mp4 (25 fps x 25.08s)
8484
expected_export_label = {
8585
"label_kind": "Video",
8686
"version": "1.0.0",

libs/labelbox/tests/integration/test_batch.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,10 +156,7 @@ def test_get_overview_batch_scoped(project: Project, small_dataset: Dataset):
156156
while timeout_seconds > 0:
157157
overview_a = project.get_overview(batch_ids=[batch_a.uid])
158158
overview_b = project.get_overview(batch_ids=[batch_b.uid])
159-
if (
160-
overview_a.total_data_rows == 1
161-
and overview_b.total_data_rows == 1
162-
):
159+
if overview_a.total_data_rows == 1 and overview_b.total_data_rows == 1:
163160
break
164161
timeout_seconds -= sleep_time
165162
time.sleep(sleep_time)

libs/labelbox/tests/unit/test_project.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ def _workstream_state_counts_response():
5050

5151
def test_get_overview_project_wide(project_entity):
5252
client = project_entity.client
53-
client.execute.return_value = {"project": _workstream_state_counts_response()}
53+
client.execute.return_value = {
54+
"project": _workstream_state_counts_response()
55+
}
5456

5557
overview = project_entity.get_overview()
5658

@@ -71,7 +73,9 @@ def test_get_overview_project_wide(project_entity):
7173

7274
def test_get_overview_batch_scoped(project_entity):
7375
client = project_entity.client
74-
client.execute.return_value = {"project": _workstream_state_counts_response()}
76+
client.execute.return_value = {
77+
"project": _workstream_state_counts_response()
78+
}
7579

7680
overview = project_entity.get_overview(batch_ids=["batch-1"])
7781

@@ -93,7 +97,10 @@ def test_get_overview_batch_scoped(project_entity):
9397
"batch_ids,expected_message",
9498
[
9599
([], "batch_ids filter expects a non-empty list."),
96-
(["batch-1"] * 1001, "batch_ids filter only supports a max of 1000 items."),
100+
(
101+
["batch-1"] * 1001,
102+
"batch_ids filter only supports a max of 1000 items.",
103+
),
97104
],
98105
)
99106
def test_validate_batch_ids_rejects_invalid(batch_ids, expected_message):
@@ -102,7 +109,9 @@ def test_validate_batch_ids_rejects_invalid(batch_ids, expected_message):
102109

103110

104111
def test_get_overview_rejects_empty_batch_ids(project_entity):
105-
with pytest.raises(ValueError, match="batch_ids filter expects a non-empty list."):
112+
with pytest.raises(
113+
ValueError, match="batch_ids filter expects a non-empty list."
114+
):
106115
project_entity.get_overview(batch_ids=[])
107116

108117

libs/lbox-alignerr/pyproject.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,10 @@ build-backend = "hatchling.build"
4646
[tool.rye]
4747
managed = true
4848
dev-dependencies = [
49-
"pytest>=8.1.1",
49+
# Cap <9: pytest 9 changed the internal IdMaker signature, which pytest-cases
50+
# (<=3.10.1) still calls the old way at import time, breaking test collection.
51+
# Remove the cap once pytest-cases supports pytest 9.
52+
"pytest>=8.1.1,<9",
5053
"pytest-cases>=3.8.4",
5154
"pytest-rerunfailures>=14.0",
5255
"pytest-snapshot>=0.9.0",

libs/lbox-alignerr/tests/conftest.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@
3333
from labelbox.schema.project import Project
3434
from labelbox.schema.quality_mode import QualityMode
3535

36-
IMG_URL = "https://picsum.photos/200/300.jpg"
36+
# Use a stable, GCS-hosted JPEG rather than a random third-party image service
37+
# so data-row creation does not depend on picsum.photos availability.
38+
IMG_URL = "https://storage.googleapis.com/lb-artifacts-testing-public/sdk_integration_test/potato.jpeg"
3739
SMALL_DATASET_URL = "https://storage.googleapis.com/lb-artifacts-testing-public/sdk_integration_test/potato.jpeg"
3840
DATA_ROW_PROCESSING_WAIT_TIMEOUT_SECONDS = 30
3941
DATA_ROW_PROCESSING_WAIT_SLEEP_INTERNAL_SECONDS = 3

pyproject.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ requires-python = ">= 3.9"
1515
managed = true
1616
virtual = true
1717
dev-dependencies = [
18-
"pytest>=8.1.1",
18+
# Cap <9: pytest 9 changed the internal IdMaker signature, which pytest-cases
19+
# (<=3.10.1) still calls the old way at import time, breaking test collection.
20+
# Remove the cap once pytest-cases supports pytest 9.
21+
"pytest>=8.1.1,<9",
1922
"pytest-cases>=3.8.4",
2023
"pytest-rerunfailures>=14.0",
2124
"pytest-snapshot>=0.9.0",

0 commit comments

Comments
 (0)