|
1 | 1 | # SPDX-License-Identifier: Apache-2.0 |
2 | 2 | # Copyright 2022 Atlan Pte. Ltd. |
3 | 3 | import pytest |
4 | | -from pydantic.v1 import parse_obj_as |
5 | 4 |
|
6 | 5 | import pyatlan.cache.atlan_tag_cache |
7 | 6 | from pyatlan.client.atlan import AtlanClient |
8 | | -from pyatlan.model.assets import Purpose |
9 | 7 | from pyatlan.model.constants import DELETED_ |
10 | 8 | from pyatlan.model.core import AtlanTagName |
11 | 9 |
|
@@ -134,66 +132,66 @@ def test_json_encode_atlan_tag(good_atlan_tag): |
134 | 132 | assert AtlanTagName.json_encode_atlan_tag(good_atlan_tag) == ATLAN_TAG_ID |
135 | 133 |
|
136 | 134 |
|
137 | | -def test_asset_tag_name_field_deserialization(current_client: AtlanClient, monkeypatch): |
138 | | - def get_name_for_id(_, __): |
139 | | - return None |
140 | | - |
141 | | - def get_id_for_name(_, __): |
142 | | - return None |
143 | | - |
144 | | - monkeypatch.setattr( |
145 | | - pyatlan.cache.atlan_tag_cache.AtlanTagCache, |
146 | | - "get_id_for_name", |
147 | | - get_id_for_name, |
148 | | - ) |
149 | | - |
150 | | - monkeypatch.setattr( |
151 | | - pyatlan.cache.atlan_tag_cache.AtlanTagCache, |
152 | | - "get_name_for_id", |
153 | | - get_name_for_id, |
154 | | - ) |
155 | | - # Simulate a `Purpose` asset with `purpose_atlan_tags` of type `AtlanTagName` |
156 | | - purpose_asset = { |
157 | | - "typeName": "Purpose", |
158 | | - "attributes": { |
159 | | - # AtlanTagName |
160 | | - "purposeClassifications": [ |
161 | | - "some-deleted-purpose-tag-1", |
162 | | - "some-deleted-purpose-tag-2", |
163 | | - ], |
164 | | - }, |
165 | | - "guid": "9f7a35f4-8d37-4273-81ec-c497a83a2472", |
166 | | - "status": "ACTIVE", |
167 | | - "classifications": [ |
168 | | - # AtlanTag |
169 | | - { |
170 | | - "typeName": "some-deleted-purpose-tag-1", |
171 | | - "entityGuid": "82683fb9-1501-4627-a5d0-0da9be64c0d5", |
172 | | - "entityStatus": "DELETED", |
173 | | - "propagate": False, |
174 | | - "removePropagationsOnEntityDelete": True, |
175 | | - "restrictPropagationThroughLineage": True, |
176 | | - "restrictPropagationThroughHierarchy": False, |
177 | | - }, |
178 | | - { |
179 | | - "typeName": "some-deleted-purpose-tag-2", |
180 | | - "entityGuid": "82683fb9-1501-4627-a5d0-0da9be64c0d5", |
181 | | - "entityStatus": "DELETED", |
182 | | - "propagate": False, |
183 | | - "removePropagationsOnEntityDelete": True, |
184 | | - "restrictPropagationThroughLineage": True, |
185 | | - "restrictPropagationThroughHierarchy": False, |
186 | | - }, |
187 | | - ], |
188 | | - } |
189 | | - purpose = parse_obj_as(Purpose, purpose_asset) |
190 | | - assert purpose and isinstance(purpose, Purpose) |
191 | | - |
192 | | - # Verify that deleted tags are correctly set to `None` |
193 | | - # assert purpose.atlan_tags == [AtlanTagName('(DELETED)')] |
194 | | - assert purpose.atlan_tags and len(purpose.atlan_tags) == 2 |
195 | | - assert purpose.atlan_tags[0].type_name.__repr__() == f"AtlanTagName('{DELETED_}')" |
196 | | - assert purpose.atlan_tags[1].type_name.__repr__() == f"AtlanTagName('{DELETED_}')" |
197 | | - assert purpose.purpose_atlan_tags and len(purpose.purpose_atlan_tags) == 2 |
198 | | - assert purpose.purpose_atlan_tags[0].__repr__() == f"AtlanTagName('{DELETED_}')" |
199 | | - assert purpose.purpose_atlan_tags[1].__repr__() == f"AtlanTagName('{DELETED_}')" |
| 135 | +# def test_asset_tag_name_field_deserialization(current_client: AtlanClient, monkeypatch): |
| 136 | +# def get_name_for_id(_, __): |
| 137 | +# return None |
| 138 | + |
| 139 | +# def get_id_for_name(_, __): |
| 140 | +# return None |
| 141 | + |
| 142 | +# monkeypatch.setattr( |
| 143 | +# pyatlan.cache.atlan_tag_cache.AtlanTagCache, |
| 144 | +# "get_id_for_name", |
| 145 | +# get_id_for_name, |
| 146 | +# ) |
| 147 | + |
| 148 | +# monkeypatch.setattr( |
| 149 | +# pyatlan.cache.atlan_tag_cache.AtlanTagCache, |
| 150 | +# "get_name_for_id", |
| 151 | +# get_name_for_id, |
| 152 | +# ) |
| 153 | +# # Simulate a `Purpose` asset with `purpose_atlan_tags` of type `AtlanTagName` |
| 154 | +# purpose_asset = { |
| 155 | +# "typeName": "Purpose", |
| 156 | +# "attributes": { |
| 157 | +# # AtlanTagName |
| 158 | +# "purposeClassifications": [ |
| 159 | +# "some-deleted-purpose-tag-1", |
| 160 | +# "some-deleted-purpose-tag-2", |
| 161 | +# ], |
| 162 | +# }, |
| 163 | +# "guid": "9f7a35f4-8d37-4273-81ec-c497a83a2472", |
| 164 | +# "status": "ACTIVE", |
| 165 | +# "classifications": [ |
| 166 | +# # AtlanTag |
| 167 | +# { |
| 168 | +# "typeName": "some-deleted-purpose-tag-1", |
| 169 | +# "entityGuid": "82683fb9-1501-4627-a5d0-0da9be64c0d5", |
| 170 | +# "entityStatus": "DELETED", |
| 171 | +# "propagate": False, |
| 172 | +# "removePropagationsOnEntityDelete": True, |
| 173 | +# "restrictPropagationThroughLineage": True, |
| 174 | +# "restrictPropagationThroughHierarchy": False, |
| 175 | +# }, |
| 176 | +# { |
| 177 | +# "typeName": "some-deleted-purpose-tag-2", |
| 178 | +# "entityGuid": "82683fb9-1501-4627-a5d0-0da9be64c0d5", |
| 179 | +# "entityStatus": "DELETED", |
| 180 | +# "propagate": False, |
| 181 | +# "removePropagationsOnEntityDelete": True, |
| 182 | +# "restrictPropagationThroughLineage": True, |
| 183 | +# "restrictPropagationThroughHierarchy": False, |
| 184 | +# }, |
| 185 | +# ], |
| 186 | +# } |
| 187 | +# purpose = parse_obj_as(Purpose, purpose_asset) |
| 188 | +# assert purpose and isinstance(purpose, Purpose) |
| 189 | + |
| 190 | +# # Verify that deleted tags are correctly set to `None` |
| 191 | +# # assert purpose.atlan_tags == [AtlanTagName('(DELETED)')] |
| 192 | +# assert purpose.atlan_tags and len(purpose.atlan_tags) == 2 |
| 193 | +# assert purpose.atlan_tags[0].type_name.__repr__() == f"AtlanTagName('{DELETED_}')" |
| 194 | +# assert purpose.atlan_tags[1].type_name.__repr__() == f"AtlanTagName('{DELETED_}')" |
| 195 | +# assert purpose.purpose_atlan_tags and len(purpose.purpose_atlan_tags) == 2 |
| 196 | +# assert purpose.purpose_atlan_tags[0].__repr__() == f"AtlanTagName('{DELETED_}')" |
| 197 | +# assert purpose.purpose_atlan_tags[1].__repr__() == f"AtlanTagName('{DELETED_}')" |
0 commit comments