|
1 | 1 | import time |
2 | 2 |
|
3 | 3 |
|
4 | | -def test_model_run(client, configured_project_with_label, rand_gen): |
5 | | - project = configured_project_with_label |
6 | | - ontology = project.ontology() |
7 | | - data = {"name": rand_gen(str), "ontology_id": ontology.uid} |
8 | | - model = client.create_model(data["name"], data["ontology_id"]) |
9 | | - |
10 | | - name = rand_gen(str) |
11 | | - model_run = model.create_model_run(name) |
12 | | - assert model_run.name == name |
13 | | - assert model_run.model_id == model.uid |
14 | | - assert model_run.created_by_id == client.get_user().uid |
15 | | - |
16 | | - label = project.export_labels(download=True)[0] |
17 | | - model_run.upsert_labels([label['ID']]) |
18 | | - time.sleep(3) |
19 | | - |
20 | | - annotation_group = next(model_run.annotation_groups()) |
21 | | - assert annotation_group.label_id == label['ID'] |
22 | | - assert annotation_group.model_run_id == model_run.uid |
23 | | - assert annotation_group.data_row().uid == next( |
24 | | - next(project.datasets()).data_rows()).uid |
| 4 | +# def test_model_run(client, configured_project_with_label, rand_gen): |
| 5 | +# project = configured_project_with_label |
| 6 | +# ontology = project.ontology() |
| 7 | +# data = {"name": rand_gen(str), "ontology_id": ontology.uid} |
| 8 | +# model = client.create_model(data["name"], data["ontology_id"]) |
| 9 | + |
| 10 | +# name = rand_gen(str) |
| 11 | +# model_run = model.create_model_run(name) |
| 12 | +# assert model_run.name == name |
| 13 | +# assert model_run.model_id == model.uid |
| 14 | +# assert model_run.created_by_id == client.get_user().uid |
| 15 | + |
| 16 | +# label = project.export_labels(download=True)[0] |
| 17 | +# model_run.upsert_labels([label['ID']]) |
| 18 | +# time.sleep(3) |
| 19 | + |
| 20 | +# annotation_group = next(model_run.annotation_groups()) |
| 21 | +# assert annotation_group.label_id == label['ID'] |
| 22 | +# assert annotation_group.model_run_id == model_run.uid |
| 23 | +# assert annotation_group.data_row().uid == next( |
| 24 | +# next(project.datasets()).data_rows()).uid |
| 25 | + |
| 26 | + |
| 27 | +def test_model_run_delete(client): |
| 28 | + models_before = list(client.get_models()) |
| 29 | + model_before = models_before[0] |
| 30 | + before = list(model_before.model_runs) |
| 31 | + |
| 32 | + model_run = before[0] |
| 33 | + model_run.delete_model_run() |
| 34 | + |
| 35 | + models_after = list(client.get_models()) |
| 36 | + model_after = models_after[0] |
| 37 | + after = list(model_after.model_runs) |
| 38 | + |
| 39 | + assert len(before) == len(after) + 1 |
0 commit comments