-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathtest_taxonomy.py
More file actions
71 lines (55 loc) · 1.97 KB
/
test_taxonomy.py
File metadata and controls
71 lines (55 loc) · 1.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import pytest
from .helpers import TEST_DATASET_NAME
@pytest.fixture()
def taxonomy_dataset(CLIENT):
ds = CLIENT.create_dataset(TEST_DATASET_NAME, is_scene=False)
ds.add_taxonomy(
"[Pytest] taxonomy",
"category",
["[Pytest] taxonomy label 1", "[Pytest] taxonomy label 2"],
)
yield ds
def test_create_taxonomy(taxonomy_dataset):
response = taxonomy_dataset.add_taxonomy(
"New [Pytest] taxonomy",
"category",
["New [Pytest] taxonomy label 1", "New [Pytest] taxonomy label 2"],
)
assert response["dataset_id"] == taxonomy_dataset.id
assert response["taxonomy_name"] == "New [Pytest] taxonomy"
assert response["status"] == "Taxonomy created"
def test_duplicate_taxonomy(taxonomy_dataset):
response = taxonomy_dataset.add_taxonomy(
"[Pytest] taxonomy",
"category",
[
"[Pytest] taxonomy label 1",
"[Pytest] taxonomy label 2",
"[Pytest] extra taxonomy label",
],
False,
)
assert response["dataset_id"] == taxonomy_dataset.id
assert response["taxonomy_name"] == "[Pytest] taxonomy"
assert response["status"] == "Taxonomy already exists"
def test_duplicate_taxonomy_update(taxonomy_dataset):
response = taxonomy_dataset.add_taxonomy(
"[Pytest] taxonomy",
"category",
[
"[Pytest] taxonomy label 1",
"[Pytest] taxonomy label 2",
"[Pytest] extra taxonomy label",
],
True,
)
assert response["dataset_id"] == taxonomy_dataset.id
assert response["taxonomy_name"] == "[Pytest] taxonomy"
assert response["status"] == "Taxonomy updated"
def test_delete_taxonomy(taxonomy_dataset):
response = taxonomy_dataset.delete_taxonomy(
"[Pytest] taxonomy",
)
assert response["dataset_id"] == taxonomy_dataset.id
assert response["taxonomy_name"] == "[Pytest] taxonomy"
assert response["status"] == "Taxonomy successfully deleted"