Skip to content

Conversation

@kaapstorm
Copy link
Contributor

Just adds tests for changes made by contributor in commit b7a93ed . No changes to functionality.

Comment on lines 69 to 71
if operation == "multiply":
return data * multiplier
return data
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: This requires some mental exercise to read. Some of that seems unnecessary.

Suggested change
if operation == "multiply":
return data * multiplier
return data
assert operation == "multiply"
return data * multiplier

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍 e5ee8d8

self.check_digest(struct.pack('III'.encode('ascii'), 1, 2, 3))


class TestUnwrap(unittest.TestCase):
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: A fair number of these tests are testing more than one thing. Would it be possible to refactor them to be parameterized?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Great idea. c09b15e

@mkangia
Copy link
Contributor

mkangia commented Nov 7, 2025

I don't fully understand the linked PR so I will defer to @millerdev for review here.
But I would love to understand what is happening there when I have some time to spare.

@kaapstorm
Copy link
Contributor Author

I would love to understand what is happening there

That is valid feedback! I hope this helps a little: 2b8e324

self.assertEqual(process_value(5, 4), 20)
assert process_value(ri, 2) == 84
assert process_value([10], 3) == 30
assert process_value(5, 4) == 20
Copy link
Contributor

Choose a reason for hiding this comment

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

Why were these not parametrized?

There are a few others as well. Not deal breaker, just curious.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Honestly, I think I just got distracted. cf3a78a

Comment on lines +109 to +112
@pytest.mark.parametrize("value,wrap_in_list", [
("extracted_value", False),
(42, True),
("nested", True),
Copy link
Contributor

Choose a reason for hiding this comment

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

Did it seem too verbose to inline the full expression here? Or is there another reason why this would not work?

Suggested change
@pytest.mark.parametrize("value,wrap_in_list", [
("extracted_value", False),
(42, True),
("nested", True),
@pytest.mark.parametrize("input_value, value", [
(jsonpath.DatumInContext(value="extracted_value", path=None, context=None), "extracted_value"),
([jsonpath.DatumInContext(value=42, path=None, context=None)], 42),
([jsonpath.DatumInContext(value="nested", path=None, context=None)], "nested"),

Copy link
Contributor Author

Choose a reason for hiding this comment

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

too verbose

Yes. It felt like unnecessary duplication, and easier to read if the parameters are only what's changing.

@kaapstorm kaapstorm merged commit b5d79a4 into master Nov 11, 2025
6 checks passed
@kaapstorm kaapstorm deleted the nh/add_tests branch November 11, 2025 14:04

finish:
needs: test
if: ${{ always() }}
Copy link
Contributor

Choose a reason for hiding this comment

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

What does this do? Is it like if True:?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This comes from the Coveralls instructions for configuring parallel builds. if: ${{ always() }} ensures that the "finish" job will run whether the "test" job succeeded, failed, or was cancelled. (GitHub docs)

Copy link
Contributor

Choose a reason for hiding this comment

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

👍 Thanks for explaining.

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.

4 participants