8000 Rename `config gs1_{message => element_string}_verify_date` by jodal · Pull Request #389 · jodal/biip · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Rename config gs1_{message => element_string}_verify_date #389

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/biip/_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ class ParseConfig:
some of its the behavior by setting these options.
"""

gs1_message_verify_date: bool = True
"""Whether to verify that the date in a GS1 message is valid.
gs1_element_strings_verify_date: bool = True
"""Whether to verify that the date in a GS1 element string is valid.

According to the GS1 General Specification, dates are required to contain a
valid year and month. Only the day of month can be left as zeros, which
Expand Down
2 changes: 1 addition & 1 deletion src/biip/gs1_element_strings.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ def _set_date_and_datetime(self, *, config: ParseConfig) -> None:
try:
self.date, self.datetime = _parse_date_and_datetime(self.value)
except ValueError as exc:
if not config.gs1_message_verify_date:
if not config.gs1_element_strings_verify_date:
return
msg = f"Failed to parse GS1 AI {self.ai} date/time from {self.value!r}."
raise ParseError(msg) from exc
Expand Down
2 changes: 1 addition & 1 deletion tests/test_gs1_messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def test_parse_with_separator_char(
(
# Invalid date "000000"
"15000000",
ParseConfig(gs1_message_verify_date=False),
ParseConfig(gs1_element_strings_verify_date=False),
GS1Message(
value="15000000",
element_strings=[
Expand Down
Loading
0