Skip to content

Add tests for untested helpers in weaviate.util#2087

Open
eeshsaxena wants to merge 1 commit into
weaviate:mainfrom
eeshsaxena:test-util-untested-helpers
Open

Add tests for untested helpers in weaviate.util#2087
eeshsaxena wants to merge 1 commit into
weaviate:mainfrom
eeshsaxena:test-util-untested-helpers

Conversation

@eeshsaxena

Copy link
Copy Markdown

Summary

A few small helpers in weaviate/util.py had no test coverage. This adds parametrized tests for them, in the style of the existing test/test_util.py:

  • _capitalize_first_letter — empty string, single character, and the distinguishing behaviour that only the first character is changed ("hELLO""HELLO", unlike str.capitalize()).
  • is_weaviate_domain — the weaviate.io / weaviate.cloud / semi.technology matches, case-insensitivity, and non-Weaviate URLs (localhost, other domains, empty string).
  • strip_newlines — single/multiple/leading/trailing newlines and no-op inputs.

Tests only — no library code changed. test/test_util.py passes (59 passed); ruff check / ruff format --check are clean.

Covers _capitalize_first_letter (empty, single-character, and the
"only the first character is changed" behaviour), is_weaviate_domain
(the weaviate.io / weaviate.cloud / semi.technology matches, case
insensitivity, and non-Weaviate URLs), and strip_newlines.

@orca-security-eu orca-security-eu Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Orca Security Scan Summary

Status Check Issues by priority
Passed Passed Infrastructure as Code high 0   medium 0   low 0   info 0 View in Orca
Passed Passed SAST high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Secrets high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Vulnerabilities high 0   medium 0   low 0   info 0 View in Orca

@weaviate-git-bot

Copy link
Copy Markdown

To avoid any confusion in the future about your contribution to Weaviate, we work with a Contributor License Agreement. If you agree, you can simply add a comment to this PR that you agree with the CLA so that we can merge.

beep boop - the Weaviate bot 👋🤖

PS:
Are you already a member of the Weaviate Forum?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants