Skip to content

Commit ff1dabc

Browse files
committed
APP-6523: Added optional description parameters to cm/attributedef.creator() methods
1 parent 11a31ce commit ff1dabc

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

pyatlan/model/typedef.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -832,6 +832,7 @@ def create(
832832
applicable_other_asset_types: Optional[OtherAssetTypes] = None,
833833
applicable_domains: Optional[Set[str]] = None,
834834
applicable_domain_types: Optional[DomainTypes] = None,
835+
description: Optional[str] = None,
835836
) -> AttributeDef:
836837
from pyatlan.utils import validate_required_fields
837838

@@ -847,7 +848,7 @@ def create(
847848
),
848849
is_new=True,
849850
cardinality=Cardinality.SINGLE,
850-
description="",
851+
description=description,
851852
name="",
852853
include_in_notification=False,
853854
is_indexable=True,
@@ -1152,7 +1153,9 @@ def with_logo_from_icon(
11521153
)
11531154

11541155
@staticmethod
1155-
def create(display_name: str) -> CustomMetadataDef:
1156+
def create(
1157+
display_name: str, description: Optional[str] = None
1158+
) -> CustomMetadataDef:
11561159
from pyatlan.utils import validate_required_fields
11571160

11581161
validate_required_fields(
@@ -1164,6 +1167,7 @@ def create(display_name: str) -> CustomMetadataDef:
11641167
category=AtlanTypeCategory.CUSTOM_METADATA,
11651168
display_name=display_name,
11661169
name=display_name,
1170+
description=description,
11671171
)
11681172

11691173

tests/integration/custom_metadata_test.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@
7575
"Uniqueness",
7676
]
7777
DQ_TYPE_EXTRA_LIST = ["Unknown", "Others"]
78+
CM_DESCRIPTION = "Automated testing of the Python SDK (cm)."
79+
ATTRIBUTE_DESCRIPTION = "Automated testing of the Python SDK (attribute)."
7880

7981
_removal_epoch: Optional[int]
8082

@@ -88,7 +90,7 @@ def create_custom_metadata(
8890
icon: Optional[AtlanIcon] = None,
8991
color: Optional[AtlanTagColor] = None,
9092
) -> CustomMetadataDef:
91-
cm_def = CustomMetadataDef.create(display_name=name)
93+
cm_def = CustomMetadataDef.create(display_name=name, description=CM_DESCRIPTION)
9294
cm_def.attribute_defs = attribute_defs
9395
if icon and color:
9496
cm_def.options = CustomMetadataDef.Options.with_logo_from_icon(
@@ -143,6 +145,7 @@ def cm_ipr(
143145
AttributeDef.create(
144146
display_name=CM_ATTR_IPR_LICENSE,
145147
attribute_type=AtlanCustomAttributePrimitiveType.STRING,
148+
description=ATTRIBUTE_DESCRIPTION,
146149
**limit_attribute_applicability_kwargs,
147150
),
148151
AttributeDef.create(
@@ -175,6 +178,7 @@ def test_cm_ipr(cm_ipr: CustomMetadataDef, limit_attribute_applicability_kwargs)
175178
assert cm_ipr.guid
176179
assert cm_ipr.name != cm_name
177180
assert cm_ipr.display_name == cm_name
181+
assert cm_ipr.description == CM_DESCRIPTION
178182
attributes = cm_ipr.attribute_defs
179183
assert attributes
180184
assert len(attributes) == 5
@@ -183,6 +187,7 @@ def test_cm_ipr(cm_ipr: CustomMetadataDef, limit_attribute_applicability_kwargs)
183187
assert one_with_limited.options
184188
assert one_with_limited.display_name == CM_ATTR_IPR_LICENSE
185189
assert one_with_limited.name
190+
assert one_with_limited.description == ATTRIBUTE_DESCRIPTION
186191
assert one_with_limited.name != CM_ATTR_IPR_LICENSE
187192
assert one_with_limited.type_name == AtlanCustomAttributePrimitiveType.STRING.value
188193
assert not one_with_limited.options.multi_value_select

tests/unit/test_base_vcr_json.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class TestBaseVCRJSON(BaseVCR):
1313

1414
BASE_URL = "https://httpbin.org"
1515

16-
@pytest.fixture(scope="session")
16+
@pytest.fixture(scope="module")
1717
def vcr_config(self):
1818
"""
1919
Override the VCR configuration to use JSON serialization across the module.

0 commit comments

Comments
 (0)