Skip to content

Commit

Permalink
add testing for match pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
ethan-cartwright committed Sep 26, 2023
1 parent 2973d65 commit c2f3b5e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion metadata-ingestion/docs/sources/dbt/dbt.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ meta_mapping:
config:
separator: ","
documentation_link:
match: "https?\:\/\/\w+((\:\d+)?\/\S*)?"
match: "(?:https?)?\:\/\/\w*[^#]*"
operation: "add_doc_link"
config:
link: {{ $match }}
Expand Down
10 changes: 5 additions & 5 deletions metadata-ingestion/tests/unit/test_mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,12 +236,12 @@ def test_operation_processor_advanced_matching_tags():

def test_operation_processor_institutional_memory():
raw_props = {
"documentation_link": "test.com",
"documentation_link": "https://test.com/documentation#ignore-this",
}
processor = OperationProcessor(
operation_defs={
"documentation_link": {
"match": ".*",
"match": r"(?:https?)?\:\/\/\w*[^#]*",
"operation": "add_doc_link",
"config": {"link": "{{ $match }}", "description": "test"},
},
Expand All @@ -252,18 +252,18 @@ def test_operation_processor_institutional_memory():

doc_link_aspect: InstitutionalMemoryClass = aspect_map["add_doc_link"]

assert doc_link_aspect.elements[0].url == "test.com"
assert doc_link_aspect.elements[0].url == "https://test.com/documentation"
assert doc_link_aspect.elements[0].description == "test"


def test_operation_processor_institutional_memory_no_description():
raw_props = {
"documentation_link": "test.com",
"documentation_link": "test.com/documentation#ignore-this",
}
processor = OperationProcessor(
operation_defs={
"documentation_link": {
"match": ".*",
"match": r"(?:https?)?\:\/\/\w*[^#]*",
"operation": "add_doc_link",
"config": {"link": "{{ $match }}"},
},
Expand Down

0 comments on commit c2f3b5e

Please sign in to comment.