-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_data.py
More file actions
89 lines (64 loc) · 2.49 KB
/
Copy pathtest_data.py
File metadata and controls
89 lines (64 loc) · 2.49 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
from hypothesis import given
from tests.tasks_data import (
automations,
clusters,
computed_tasks,
idling_responses,
jobs,
progress_indicators,
storage_locations,
task_identifiers,
task_leases,
task_submissions,
tasks,
)
from tilebox.workflows.data import (
AutomationPrototype,
Cluster,
ComputedTask,
Idling,
Job,
ProgressIndicator,
StorageLocation,
Task,
TaskIdentifier,
TaskLease,
TaskSubmission,
)
@given(task_identifiers())
def test_task_identifiers_to_message_and_back(task_id: TaskIdentifier) -> None:
assert TaskIdentifier.from_message(task_id.to_message()) == task_id
@given(progress_indicators())
def test_progress_indicators_to_message_and_back(progress_indicator: ProgressIndicator) -> None:
assert ProgressIndicator.from_message(progress_indicator.to_message()) == progress_indicator
@given(tasks())
def test_tasks_to_message_and_back(task: Task) -> None:
assert Task.from_message(task.to_message()) == task
@given(idling_responses())
def test_idling_responses_to_message_and_back(idling: Idling) -> None:
assert Idling.from_message(idling.to_message()) == idling
@given(jobs())
def test_jobs_to_message_and_back(job: Job) -> None:
assert Job.from_message(job.to_message()) == job
@given(clusters())
def test_cluster_repr(cluster: Cluster) -> None:
assert cluster.slug in repr(cluster)
assert cluster.display_name in repr(cluster)
@given(clusters())
def test_clusters_to_message_and_back(cluster: Cluster) -> None:
assert Cluster.from_message(cluster.to_message()) == cluster
@given(task_submissions())
def test_sub_tasks_to_message_and_back(sub_task: TaskSubmission) -> None:
assert TaskSubmission.from_message(sub_task.to_message()) == sub_task
@given(computed_tasks())
def test_computed_tasks_to_message_and_back(computed_task: ComputedTask) -> None:
assert ComputedTask.from_message(computed_task.to_message()) == computed_task
@given(task_leases())
def test_task_leases_to_message_and_back(task_lease: TaskLease) -> None:
assert TaskLease.from_message(task_lease.to_message()) == task_lease
@given(storage_locations())
def test_buckets_to_message_and_back(storage_location: StorageLocation) -> None:
assert StorageLocation.from_message(storage_location.to_message()) == storage_location
@given(automations())
def test_automation_to_message_and_back(automation: AutomationPrototype) -> None:
assert AutomationPrototype.from_message(automation.to_message()) == automation