deltafi 2.0rc1720728217472__py3-none-any.whl → 2.0rc1722532930396__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
deltafi/test_kit/load.py DELETED
@@ -1,128 +0,0 @@
1
- #
2
- # DeltaFi - Data transformation and enrichment platform
3
- #
4
- # Copyright 2021-2023 DeltaFi Contributors <deltafi@deltafi.org>
5
- #
6
- # Licensed under the Apache License, Version 2.0 (the "License");
7
- # you may not use this file except in compliance with the License.
8
- # You may obtain a copy of the License at
9
- #
10
- # http://www.apache.org/licenses/LICENSE-2.0
11
- #
12
- # Unless required by applicable law or agreed to in writing, software
13
- # distributed under the License is distributed on an "AS IS" BASIS,
14
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- # See the License for the specific language governing permissions and
16
- # limitations under the License.
17
- #
18
-
19
- from typing import List
20
-
21
- from deltafi.result import LoadResult, ReinjectResult
22
-
23
- from .assertions import *
24
- from .compare_helpers import GenericCompareHelper, CompareHelper
25
- from .framework import TestCaseBase, ActionTest, IOContent
26
-
27
-
28
- class LoadTestCase(TestCaseBase):
29
- def __init__(self, fields: Dict):
30
- super().__init__(fields)
31
- self.metadata = {}
32
- self.delete_metadata_keys = []
33
- self.annotations = {}
34
- self.domains = []
35
- self.domain_cmp_tool = GenericCompareHelper()
36
- self.children = []
37
-
38
- def set_domain_compare_tool(self, helper: CompareHelper):
39
- self.domain_cmp_tool = helper
40
-
41
- def expect_load_result(self, metadata: Dict, delete_metadata_keys: List[str], annotations: Dict, domains: List):
42
- self.expected_result_type = LoadResult
43
- self.metadata = metadata
44
- self.delete_metadata_keys = delete_metadata_keys
45
- self.annotations = annotations
46
- self.domains = domains
47
-
48
- def add_reinject_child(self, filename: str, flow: str, content: IOContent, metadata: Dict):
49
- self.expected_result_type = ReinjectResult
50
- self.children.append(
51
- {
52
- "filename": filename,
53
- "flow": flow,
54
- "content": content,
55
- "metadata": metadata
56
- }
57
- )
58
-
59
-
60
- class LoadActionTest(ActionTest):
61
- def __init__(self, package_name: str):
62
- """
63
- Provides structure for testing DeltaFi Load action
64
- Args:
65
- package_name: name of the actions package for finding resources
66
- """
67
- super().__init__(package_name)
68
-
69
- def load(self, test_case: LoadTestCase):
70
- if test_case.expected_result_type == ReinjectResult:
71
- self.expect_reinject_result(test_case)
72
- elif test_case.expected_result_type == LoadResult:
73
- self.expect_load_result(test_case)
74
- else:
75
- super().execute(test_case)
76
-
77
- def expect_load_result(self, test_case: LoadTestCase):
78
- result = super().run_and_check_result_type(test_case, LoadResult)
79
- self.assert_load_result(test_case, result)
80
-
81
- def expect_reinject_result(self, test_case: LoadTestCase):
82
- result = super().run_and_check_result_type(test_case, ReinjectResult)
83
- self.assert_reinject_result(test_case, result)
84
-
85
- def assert_load_result(self, test_case: LoadTestCase, result: LoadResult):
86
- # Check metrics
87
- self.compare_metrics(test_case.expected_metrics, result.metrics)
88
-
89
- # Check output
90
- self.compare_all_output(test_case.compare_tool, result.content)
91
-
92
- # Check metadata
93
- assert_keys_and_values(test_case.metadata, result.metadata)
94
-
95
- # Check deleted metadata
96
- for key in test_case.delete_metadata_keys:
97
- assert_key_in(key, result.delete_metadata_keys)
98
-
99
- # Check annotations
100
- assert_keys_and_values(test_case.annotations, result.annotations)
101
-
102
- # Check domains
103
- self.compare_domains(test_case.domain_cmp_tool, test_case.domains, result.domains)
104
-
105
- def assert_reinject_result(self, test_case: LoadTestCase, actual: ReinjectResult):
106
- # Check metrics
107
- self.compare_metrics(test_case.expected_metrics, actual.metrics)
108
-
109
- # Check reinject
110
- assert_equal_len(test_case.children, actual.children)
111
- for index, expected in enumerate(test_case.children):
112
- reinject_child = actual.children[index]
113
- assert_equal(expected['filename'], reinject_child.filename)
114
- assert_equal(expected['flow'], reinject_child.flow)
115
- assert_keys_and_values(expected['metadata'], reinject_child.metadata)
116
-
117
- expected_value = expected['content']
118
- child_content = reinject_child.content[0]
119
- seg_id = child_content.segments[0].uuid
120
- actual_content = self.content_service.get_output(seg_id)
121
-
122
- if type(expected_value) == str:
123
- test_case.domain_cmp_tool.compare(expected_value, actual_content, f"RI_child[{index}]")
124
- elif type(expected_value) == IOContent:
125
- expected_data = self.load_file(expected_value)
126
- test_case.domain_cmp_tool.compare(expected_data, actual_content, f"RI_child[{index}]")
127
- else:
128
- raise ValueError(f"unknown expected_value type: {type(expected_value)}")
@@ -1,54 +0,0 @@
1
- #
2
- # DeltaFi - Data transformation and enrichment platform
3
- #
4
- # Copyright 2021-2023 DeltaFi Contributors <deltafi@deltafi.org>
5
- #
6
- # Licensed under the Apache License, Version 2.0 (the "License");
7
- # you may not use this file except in compliance with the License.
8
- # You may obtain a copy of the License at
9
- #
10
- # http://www.apache.org/licenses/LICENSE-2.0
11
- #
12
- # Unless required by applicable law or agreed to in writing, software
13
- # distributed under the License is distributed on an "AS IS" BASIS,
14
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- # See the License for the specific language governing permissions and
16
- # limitations under the License.
17
- #
18
-
19
- from deltafi.result import ValidateResult
20
-
21
- from .assertions import *
22
- from .framework import TestCaseBase, ActionTest
23
-
24
-
25
- class ValidateTestCase(TestCaseBase):
26
- def __init__(self, fields: Dict):
27
- super().__init__(fields)
28
-
29
- def expect_validate_result(self):
30
- self.expected_result_type = ValidateResult
31
-
32
-
33
- class ValidateActionTest(ActionTest):
34
- def __init__(self, package_name: str):
35
- """
36
- Provides structure for testing DeltaFi Validate action
37
- Args:
38
- package_name: name of the actions package for finding resources
39
- """
40
- super().__init__(package_name)
41
-
42
- def validate(self, test_case: ValidateTestCase):
43
- if test_case.expected_result_type == ValidateResult:
44
- self.expect_validate_result(test_case)
45
- else:
46
- super().execute(test_case)
47
-
48
- def expect_validate_result(self, test_case: ValidateTestCase):
49
- result = super().run_and_check_result_type(test_case, ValidateResult)
50
- self.assert_validate_result(test_case, result)
51
-
52
- def assert_validate_result(self, test_case: ValidateTestCase, result: ValidateResult):
53
- # Check metrics
54
- self.compare_metrics(test_case.expected_metrics, result.metrics)
@@ -1,28 +0,0 @@
1
- deltafi/__init__.py,sha256=qv6y7PpBG0ekTN9EuD9Lj8JYOLVqZA6tvHwgjplncAM,709
2
- deltafi/action.py,sha256=TM8HwfC12GgfHMBWPmO88N7J9xvwGO8BMwxKTNqwg9A,10498
3
- deltafi/actioneventqueue.py,sha256=mCRE1PFXy_KvaeezTeMze5N400CO1V06zEF8FFD6xZk,2847
4
- deltafi/actiontype.py,sha256=SgCxs5Kn_6BuzuKDk5h93ZLtfdbzV0sWLcEaaB0mqlU,997
5
- deltafi/domain.py,sha256=M97_n6KsMmIxCh3h622jNj1n6c5iMEAOn-SFH36oLis,12161
6
- deltafi/exception.py,sha256=qQ2TY2QPtMU9t5RH8jmFo_cX98AJ-zOFWP_Wfm5U6qQ,1149
7
- deltafi/genericmodel.py,sha256=8VXWgFMjIwG4o3rkcLOa3bQH0Nf-T1Kw621QtMw-4q0,1090
8
- deltafi/input.py,sha256=DuY280ZglZxEUkhjTtyr0g9Ohu2drn16UVhASH244nA,6290
9
- deltafi/logger.py,sha256=q76R_Gn8BfcASH3Zy0V82m5ot34bjTnSELyKbjhvx3E,2136
10
- deltafi/metric.py,sha256=eIDjZQVO53KuAFoEtjLNFwqMrp_7BC0Td9GLD1tb6sE,967
11
- deltafi/plugin.py,sha256=GkDq9oc5O0QYUZ7CdYcP1f9zRT38ufvzudZ4addHVS8,13076
12
- deltafi/result.py,sha256=KkFKewPxcP8_Slp0D2COJ43h5_fF5Vti9ocWtp8pjpc,14911
13
- deltafi/storage.py,sha256=toq58EPZgzj2TfDF-YpFUmRnsWSjACA0KQAZzkM04xU,2740
14
- deltafi/test_kit/__init__.py,sha256=qv6y7PpBG0ekTN9EuD9Lj8JYOLVqZA6tvHwgjplncAM,709
15
- deltafi/test_kit/assertions.py,sha256=2eahqmbedhnHXMguiJHdaV-6sx4_jvCbxH4HSzx6PV8,1378
16
- deltafi/test_kit/compare_helpers.py,sha256=Q0e14q4XQ4rlMUbPt3aMHThAXHFRXlue3-M4oAayyJE,12957
17
- deltafi/test_kit/constants.py,sha256=epz0OS-qILcc8t7iIs5B3m2-wvZx8FpYpyb19ZsImbI,833
18
- deltafi/test_kit/domain.py,sha256=uqpDravlb6E3Ddm4QpRaJTdiVuQ2MMdZnzc4Oi9EZJA,2090
19
- deltafi/test_kit/egress.py,sha256=nF7YYak-_X35m7h2rSIcju86IJBf8cVaFHs7xw7-_b8,1899
20
- deltafi/test_kit/enrich.py,sha256=M682cqInVS4aipI0jOrR25x7m0ErrpjGpebXGZDPwxo,2587
21
- deltafi/test_kit/format.py,sha256=j5spoimv4fIB7wrPSUS-aLcYvDJS0ntu4oSJjQ1INsw,4170
22
- deltafi/test_kit/framework.py,sha256=5PTWoKu8eMU5GaVLmyoghoOrp6G65efXwqZKlUlyEaM,14733
23
- deltafi/test_kit/load.py,sha256=dzXZDjb5BKxM9F5E2B06ArnGy0HvE1kwPizL8VybsOQ,5055
24
- deltafi/test_kit/transform.py,sha256=AZ5oamhaOm4yaR07_gCoTlDiHkd4KwiAWWNj3mnYp8Q,2706
25
- deltafi/test_kit/validate.py,sha256=NnXD5amOE_9a4Zr-v9DKYIv5f_HvwtmlI-IdFtVp7ko,1933
26
- deltafi-2.0rc1720728217472.dist-info/METADATA,sha256=lhhN66ZvCacThjEosjup0r8FOzyPPvEs-Lt0LWQnFQc,1446
27
- deltafi-2.0rc1720728217472.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
28
- deltafi-2.0rc1720728217472.dist-info/RECORD,,