Skip to content

Commit

Permalink
fix: fix incorrectly updated descriptions (#116)
Browse files Browse the repository at this point in the history
* add failing tests

* fix tests themselves then resolve all failing

* fix linting

* ignore call order in test
  • Loading branch information
pnadolny13 authored Jan 29, 2024
1 parent 69e7e5f commit 42c2fc6
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 14 deletions.
14 changes: 13 additions & 1 deletion hub_utils/meltano_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,16 @@ def _split_sentence_endings(word_list):
continue
if not any(
keyword in word
for keyword in ("http", "ssh", "ssl", "e.g.", '"', "`")
for keyword in (
"http",
"ssh",
"ssl",
"e.g.",
'"',
"`",
"()",
".com",
)
):
desc_list_clean.extend(word.replace(".", ". ").split())
continue
Expand All @@ -403,6 +412,9 @@ def _capitalize(cleaned_sentence):
or sentence_list[0][0] == "'"
or last_elem.endswith("e.g")
or last_elem.endswith("i.e")
or sentence_list[0].startswith("tap-")
or sentence_list[0].startswith("target-")
or sentence_list[0].startswith("http")
):
clean_capital_list.append(" ".join(sentence_list))
else:
Expand Down
27 changes: 15 additions & 12 deletions tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,21 @@ def test_download_metadata_ignore(patch):
ignore_list_str="extractors/tap-hubspot/hotgluexyz"
)
assert patch.call_count == 2
patch.assert_has_calls([
call(
expected_bucket,
"extractors/tap-hubspot/meltanolabs",
f"{local_path}/extractors/tap-hubspot/meltanolabs.json"
),
call(
expected_bucket,
"extractors/tap-github/meltanolabs",
f"{local_path}/extractors/tap-github/meltanolabs.json"
)
])
patch.assert_has_calls(
[
call(
expected_bucket,
"extractors/tap-hubspot/meltanolabs",
f"{local_path}/extractors/tap-hubspot/meltanolabs.json"
),
call(
expected_bucket,
"extractors/tap-github/meltanolabs",
f"{local_path}/extractors/tap-github/meltanolabs.json"
)
],
any_order=True
)

@patch.object(S3, "download_latest")
def test_download_metadata_list(patch):
Expand Down
5 changes: 4 additions & 1 deletion tests/test_meltano_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,10 @@ def test_get_quality(input, expected):
["Path to .duckdb file", "Path to .duckdb file"],
["Foo .env file.", "Foo .env file."],
["By (e.g. myFolder/thisTable/) sit, S3. This is replicate.", "By (e.g. myFolder/thisTable/) sit, S3. This is replicate."],
[["foo.Test."], ""],
["Request timeout used when not overridden in Session.execute().", "Request timeout used when not overridden in Session.execute()."],
['For example, "from:[email protected] rfc822msgid:<[email protected]> is:unread"."', 'For example, "from:[email protected] rfc822msgid:<[email protected]> is:unread"."'],
["tap-saasoptics <api_user_email@your_company.com>.", "tap-saasoptics <api_user_email@your_company.com>."],
["https://api.totango.com", "https://api.totango.com"]
]
)
def test_clean_description(input, expected):
Expand Down

0 comments on commit 42c2fc6

Please sign in to comment.