|
1 | 1 | import uuid |
| 2 | +import datetime |
2 | 3 |
|
3 | 4 | from labelbox.data.annotation_types.annotation import ObjectAnnotation |
4 | 5 | from labelbox.schema.annotation_import import LabelImport |
@@ -98,3 +99,47 @@ def test_export_filtered_dates(client, |
98 | 99 | start="2020-01-01", |
99 | 100 | end="2020-01-02") |
100 | 101 | assert len(empty_export) == 0 |
| 102 | + |
| 103 | + |
| 104 | +def test_export_filtered_activity(client, |
| 105 | + configured_project_with_complex_ontology): |
| 106 | + project, data_row = configured_project_with_complex_ontology |
| 107 | + ontology = project.ontology().normalized |
| 108 | + |
| 109 | + tool = ontology["tools"][0] |
| 110 | + |
| 111 | + data = [{ |
| 112 | + "uuid": str(uuid.uuid4()), |
| 113 | + "schemaId": tool['featureSchemaId'], |
| 114 | + "dataRow": { |
| 115 | + "id": data_row.uid |
| 116 | + }, |
| 117 | + "bbox": { |
| 118 | + "top": 20, |
| 119 | + "left": 20, |
| 120 | + "height": 50, |
| 121 | + "width": 50 |
| 122 | + } |
| 123 | + }] |
| 124 | + |
| 125 | + task = LabelImport.create_from_objects(client, project.uid, |
| 126 | + f'label-import-{uuid.uuid4()}', data) |
| 127 | + task.wait_until_done() |
| 128 | + |
| 129 | + regular_export = project.export_labels(download=True) |
| 130 | + assert len(regular_export) == 1 |
| 131 | + |
| 132 | + filtered_export = project.export_labels(download=True, |
| 133 | + last_activity_start="2020-01-01") |
| 134 | + assert len(filtered_export) == 1 |
| 135 | + |
| 136 | + filtered_export_with_time = project.export_labels( |
| 137 | + download=True, last_activity_start="2020-01-01 00:00:01") |
| 138 | + assert len(filtered_export_with_time) == 1 |
| 139 | + |
| 140 | + empty_export = project.export_labels( |
| 141 | + download=True, |
| 142 | + last_activity_start=(datetime.datetime.now() + |
| 143 | + datetime.timedelta(days=1)).strftime("%Y-%m-%d"), |
| 144 | + ) |
| 145 | + assert len(empty_export) == 0 |
0 commit comments