-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_data_pipeline.py
46 lines (35 loc) · 1.79 KB
/
test_data_pipeline.py
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
from unittest import TestCase
from data_pipeline import Pipeline, PipelineElement, ElType
class TestPipeline(TestCase):
def setUp(self):
self.pipeline = Pipeline("Dependency Test",
[
PipelineElement(ElType.SOURCE, "a"),
PipelineElement(ElType.TRANSFORMATION, "b"),
PipelineElement(ElType.TABLE, "c"),
PipelineElement(ElType.REPORT, "d"),
PipelineElement(ElType.REPORT, "e"),
PipelineElement(ElType.REPORT, "f"),
PipelineElement(ElType.REPORT, "g"),
PipelineElement(ElType.REPORT, "g"),
],
[(1, 2), (1, 3), (1, 4), (2, 4)]
)
def test_init(self):
self.assertEqual(self.pipeline.name, "Dependency Test")
self.assertEqual(self.pipeline.dependencies, {1: [2, 3, 4], 2: [4]})
self.assertEqual(self.pipeline.vertices[1].element_type, ElType.SOURCE)
self.assertEqual(self.pipeline.vertices[1].element_name, 'a')
self.assertEqual(self.pipeline.vertices[3].element_name, 'c')
def test_add_dependency(self):
self.fail()
def test_find_dependencies(self):
dependencies = self.pipeline.find_dependencies(1)
self.assertEqual(dependencies, {1, 2, 3, 4})
def test_trace_lineage(self):
dependencies = self.pipeline.trace_lineage(4)
self.assertEqual(dependencies, {4,2,1})
class TestElType(TestCase):
def test_print(self):
a = ElType.REPORT
self.assertEqual(ElType.REPORT.name, "REPORT")