Files
article-data-manager/src/article_data_manager/validation/article_number.py
T

13 lines
422 B
Python

"""Article number normalization."""
def normalize_article_number(value: str) -> str:
"""Trim surrounding whitespace while preserving leading zeros and text content."""
if not isinstance(value, str):
raise TypeError("Article number must be provided as a string.")
normalized = value.strip()
if normalized == "":
raise ValueError("Article number must not be empty.")
return normalized