Skip to content
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

don't convert str to tuple in TupleParameter #3275

Merged
merged 2 commits into from
Jan 23, 2024

Conversation

kitagry
Copy link
Contributor

@kitagry kitagry commented Jan 22, 2024

Description

TupleParameter may convert str to tuple, and I fixed it.

Motivation and Context

Currently, TupleParameter returns unexpected value when to parse json string list.

>>> x = '["hoge", "fuga"]'
>>> TupleParameter().parse(x)
(('h', 'o', 'g', 'e'), ('f', 'u', 'g', 'a'))

Have you tested this? If so, how?

I added unit test.

@kitagry kitagry requested review from dlstadther and a team as code owners January 22, 2024 02:10
jsonschema validation error message was changed. I think it is very flaky test.
@@ -81,7 +81,7 @@ def test_schema(self):
a.normalize(["INVALID_ATTRIBUTE"])

# Check that empty list is not valid
with pytest.raises(ValidationError, match=r"\[\] is too short"):
with pytest.raises(ValidationError):
Copy link
Contributor Author

@kitagry kitagry Jan 22, 2024

Choose a reason for hiding this comment

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

CI failed because jsonschema validation error is changed.

I think the message should not be compared because it will be very flaky test. Do you think about this?

# before
with pytest.raises(ValidationError, match=r"\[\] is too short"):
    a.normalize([])

# after
with pytest.raises(ValidationError, '\[\] should be non-empty'):
    a.normalize([])

Copy link
Contributor

@andresgomezfrr andresgomezfrr left a comment

Choose a reason for hiding this comment

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

LGTM

@andresgomezfrr andresgomezfrr merged commit 25d179b into spotify:master Jan 23, 2024
45 checks passed
@kitagry kitagry deleted the fix-tuple-parameter branch January 24, 2024 00:56
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