|
39 | 39 | TEST_IMG_URLS, |
40 | 40 | TEST_POLYGON_ANNOTATIONS, |
41 | 41 | TEST_SEGMENTATION_ANNOTATIONS, |
| 42 | + DATASET_WITH_AUTOTAG, |
| 43 | + NUCLEUS_PYTEST_USER_ID, |
42 | 44 | reference_id_from_url, |
43 | 45 | ) |
44 | 46 |
|
45 | | -TEST_AUTOTAG_DATASET = "ds_bz43jm2jwm70060b3890" |
46 | | - |
47 | 47 |
|
48 | 48 | def test_reprs(): |
49 | 49 | # Have to define here in order to have access to all relevant objects |
@@ -332,17 +332,17 @@ def test_raises_error_for_duplicate(): |
332 | 332 | def test_dataset_export_autotag_scores(CLIENT): |
333 | 333 | # This test can only run for the test user who has an indexed dataset. |
334 | 334 | # TODO: if/when we can create autotags via api, create one instead. |
335 | | - if os.environ.get("HAS_ACCESS_TO_TEST_DATA", False): |
336 | | - dataset = CLIENT.get_dataset(TEST_AUTOTAG_DATASET) |
| 335 | + if NUCLEUS_PYTEST_USER_ID in CLIENT.api_key: |
| 336 | + dataset = CLIENT.get_dataset(DATASET_WITH_AUTOTAG) |
337 | 337 |
|
338 | 338 | with pytest.raises(NucleusAPIError) as api_error: |
339 | 339 | dataset.autotag_scores(autotag_name="NONSENSE_GARBAGE") |
340 | 340 | assert ( |
341 | | - f"The autotag NONSENSE_GARBAGE was not found in dataset {TEST_AUTOTAG_DATASET}" |
| 341 | + f"The autotag NONSENSE_GARBAGE was not found in dataset {DATASET_WITH_AUTOTAG}" |
342 | 342 | in str(api_error.value) |
343 | 343 | ) |
344 | 344 |
|
345 | | - scores = dataset.autotag_scores(autotag_name="TestTag") |
| 345 | + scores = dataset.autotag_scores(autotag_name="PytestTestTag") |
346 | 346 |
|
347 | 347 | for column in ["dataset_item_ids", "ref_ids", "scores"]: |
348 | 348 | assert column in scores |
@@ -491,3 +491,10 @@ def sort_labelmap(segmentation_annotation): |
491 | 491 | assert exported[0][ANNOTATIONS_KEY][POLYGON_TYPE][0] == clear_fields( |
492 | 492 | polygon_annotation |
493 | 493 | ) |
| 494 | + |
| 495 | + |
| 496 | +def test_export_embeddings(CLIENT): |
| 497 | + if NUCLEUS_PYTEST_USER_ID in CLIENT.api_key: |
| 498 | + embeddings = Dataset(DATASET_WITH_AUTOTAG, CLIENT).export_embeddings() |
| 499 | + assert "embedding_vector" in embeddings[0] |
| 500 | + assert "reference_id" in embeddings[0] |
0 commit comments